问题背景及内容
背景
学习Vue过程中,学习接受父组件传来的值时,使用v-bind:f_name=“xxxx”,遇到该错误。
.vue文件:
<HelloWorld v-bind:f_name="stirng小明"></HelloWorld>
报错内容
子组件Property or method "xxx" is not defined on the instance but referenced during render.
原因及解决
原因
.vue文件标签内属性的使用。
解决
改成:
<HelloWorld v-bind:f_name = "stirng小明"></HelloWorld>
或者
<HelloWorld v-bind:f_name="'stirng小明'"></HelloWorld>
最好都保持有空格
拓展
v-on:等价于@ v-bind:等价于: