报错一: Unknown custom element: <custom-select> - did you register the component correctly? For recursive components, make sure to provide the "name" option

代码:

html

<custom-select v-bind:list="list2"></custom-select>

js

new Vue({
el: "#app",
data:{
list1: [{"name":"beijing"}, {"name" : "hangzhou" }],
list2: ["2017-1-1", "2017-3-3"]
}
});
//<li class="match-list-li">'+value.name+'</li>
Vue.component("custom-select", {
data: function(){
return {
selectShow : false,
val: ""
};
},
props: ["list"],
template: `
<input type="text" class="form-control" placeholder='press "enter" to match the Employee'
@click="selectShow = !selectShow"
:value="val"> <match-list v-show="selectShow"
:list="list"
v-on:received="changeValueHandler"
></match-list> `,
methods : {
//v-on:received 订阅事件
changeValueHandler(value){
this.val = value; }
}
});
//child
Vue.component("match-list", {
props: ["list"],
template: `
<ul class="repo-admin-match">
<li class="match-list-li" v-for="item of list" @click="changeValueHandler(item)">{{item}}</li>
</ul>
`,
methods : {
changeValueHandler : function(name){
//在子组件中有交互
//告知父级 改变val 需发出一个自定义事件
this.$emit("received", name);
}
}
});

报错原因:

先新建了Vue(new Vue),然后注册组件(Vue.component) 。把顺序颠倒一下即可解决

------------------------------------

报错2:error compiling template

这个一般是写的不符合规范,不能被编译

--Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.大意应该是Component template应该包含一个确切存在的根元素

所以 我用<section class="wrap"></wrap>包裹起来

Vue入门之旅:一报错 Unknown ... make sure to provide the "name" option及error compiling template的更多相关文章

  1. scp使用加密算法报错unknown cipher type

    为了提高scp的传输速度指定了scp的加密算法为arcfour $ scp -c arcfour localFile userName@remoteIP:remoteFile 得到报错unknown ...

  2. vue使用v-for时vscode报错 Elements in iteration expect to have 'v-bind:key' directives

    vue使用v-for时vscode报错 Elements in iteration expect to have 'v-bind:key' directives Vue 2.2.0+的版本里,当在组件 ...

  3. jmeter------reponse报错”Unknown column 'XXXXX' in 'where clause'“

    一.问题描述 jmeter添加了与数据库mysql的连接,编写完JDBC Request之后,运行提示报错”Unknown column 'be7f5b6e750bb6becf855386338644 ...

  4. springboot项目POM文件第一行报错 Unknown Error

    改成 war 不错了,但是打包麻烦 pom 文件报错 UnKnown Error第一次碰到这个问题,花了几个小时才解决,除了UnKnown 没有任何提示.网上搜的大部分情况都不是我遇到的. 还是没有解 ...

  5. 使用spring boot 2.1.8生成的maven项目pom.xml第一行报错unknown error

    问题:eclipse neon4.6.3新建springboot项目时pom.xml报错unknown error 原因: spring boot 2.1.8更新了maven插件,eclipse不兼容 ...

  6. vuex2 mapActions 报错 `unknown action type: xxxx`

    export const setBreadCrumb = ({ dispatch }, data) => { dispatch('SET_BREADCRUMB', data) } 当调用的时候报 ...

  7. 解决centos7下 selenium报错--unknown error: DevToolsActivePort file doesn't exist

    解决centos7下 selenium报错--unknown error: DevToolsActivePort file doesn't exist 早上在linux下用selenium启动Chro ...

  8. springboot项目的maven的pom.xml文件第一行报错 Unknown Error

    springboot项目的maven的pom.xml文件第一行报错 Unknown Error https://blog.csdn.net/mini_jike/article/details/9239 ...

  9. idea使用Vue的v-bind,v-on报错

    参考解决在WebStorm中使用Vue的v-bind,v-on报错 File-->Settings-->Editor-->Inspections-->XML 把 Unbound ...

随机推荐

  1. c#.net调用pdf2swf.exe将pdf文件转换为swf,vs中运行正常,布署IIS服务器部署转换后文字部分为空白

    这个是权限问题, 需要在应用程序池中高级设置,将标识改为LocalSystem

  2. js 时间戳

    https://www.cnblogs.com/crf-Aaron/archive/2017/11/16/7844462.html var time = '2018-03-22 00:00:00'.r ...

  3. 点滴积累【JS】---JS小功能(JS实现匀速运动)

    效果: 思路: 利用setInerval()计时器,进行运动.然后关键的一点是在最后停止的时候给它一个填充缝隙的判断. 代码: <head runat="server"> ...

  4. Atitit. WordPress 4.2.2新特性对比 attilax总结

    Atitit. WordPress 4.2.2新特性对比 attilax总结 1. WordPress 2.9带来的新特性 1 2. WordPress3.0最为突出的五个新特征 2 3. WordP ...

  5. __attribute__机制介绍(转)

    转自 http://blog.csdn.net/ithomer/article/details/6566739 1. __attribute__ GNU C的一大特色(却不被初学者所知)就是__att ...

  6. LDAP实战应用指南

    第1章 ladp master服务安装 1.1 安装前系统环境准备 1.1.1 查看系统版本信息 [root@ldap-server ~]# cat /etc/redhat-release CentO ...

  7. PHP进制转换[实现2、8、16、36、64进制至10进制相互转换]

    自己写了一个PHP进制转换程序,一个类吧,第一次写这个东东,写这个东东,在处理文本文件时能用得到.   可以实现: 10进制转换2.8.16.36.62进制2.8.16.36.62进制转换10进制 有 ...

  8. hive export import命令

    EXPORT TABLE stu_p TO 导入表(必须明白导出表,导出表是将表的元数据,数据导出到hdfs上.)讲一个导出的表导入到数据库中,这个hdfs_path 是一个导出表的文件夹 impor ...

  9. 迅搜sdk试用

    1. sdk支持PHP 2. 针对mysql的某个库的某个表??进行索引,简单的说就是一个project,需要对应一个配置文件: 3. 分索引服务与搜索服务两个,另带中文分词功能:索引数据会有演示,但 ...

  10. 解读MT7620A上的DTS文件

    DTS文件,即Device Tree Source,是某些芯片(在Openwrt的target/linux/中,至少ramips,lantiq和BRCM有此文件)用于描述硬件设备资源的文件.此文件是驱 ...