The "data" option should be a function that returns a per-instance value in component definitions.Property or method "bm" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.



意思是data必须是一个方法,如下:
data(){
return {
//在这里写
}
}
Vue组件data为什么必须是个函数而Vue的根实例则没有限制的原因是:
Vue组件可能存在多个实例,如果使用对象形式定义data,则会导致他们共用一个data对象,那么状态变更将会影响所有组件实例,这是不合理的;采用函数形式定义,在initData时会将其作为工厂函数返回全新data对象,有效规避多实例之间状态污染问题。而在Vue根实例创建过程中则不存在该限制,也是因为跟实例只有一个,不用担心这种情况。