为什么 组件没有生效啊 感觉代码没问题啊 还是从官网粘贴的
vuejs吧
全部回复
仅看楼主
level 1
神月💕 楼主
2019年03月31日 03点03分 1
level 7
能不能把整个页面截图一下
2019年03月31日 07点03分 2
您好 放楼下了
2019年03月31日 16点03分
level 1
神月💕 楼主
2019年03月31日 16点03分 3
level 3
整个页面都没显示吗?
2019年04月01日 06点04分 4
截图就在楼上 那个h4标签显示没问题 就是下面的那个组件显示不出来
2019年04月01日 08点04分
回复 神月💕 :把引入的vue文件放在div的下面试试?
2019年04月02日 06点04分
level 7
抱歉,现在才回复,你在浏览器的console里输入new Vue({el:'#vueDiv'})就可以看到了。
--------------
或者,你把组件模版Vue.component('button-counter', {data: function() {return {count: 0}},template: '<button v-on:click="count++">You clicked me {{ count }} times.</button>'})
放在var vm = Vue(...的前面,就生效了。
2019年04月02日 07点04分 5
试了一下 非常感谢 确实是这样的[玫瑰]
2019年04月02日 12点04分
level 7
我找到了官网上你的这个例子。
你可以理解为,var vm = new Vue () 这个表达式在定义的时候没有发现Vue.component,因为它的作用域只能发现在它之前生成的东西。
2019年04月02日 07点04分 6
level 7
2019年04月02日 07点04分 7
level 4
注册组件写在实例前面。。。
2019年04月09日 03点04分 8
1