【发布时间】:2017-08-01 14:04:52
【问题描述】:
https://www.npmjs.com/package/vue-model
上述代码的示例在我的环境中不起作用:
vue: ^2.2.1,
vue-model": 0.0.3,
Vue.models.register('customer', {
baseRoute: '/customers'
});
通过上述示例注册客户模型后, 我应该能够引用客户对象,
customer.$.update()
但错误返回,
http://eslint.org/docs/rules/no-undef“客户”未定义
/Users/murotanimari/my-project/src/components/Scene1.vue:19:1 客户.$.update() ^
我假设注册到 vue 模型失败... 有人知道这次失败的原因吗?
【问题讨论】:
-
尝试使用“this.customer”?顺便说一句,这是一个很少使用的模块,所以你最好在它的 github repo 的“问题”列表中提出这个问题。
-
你在哪里打电话 customer.$.update() ?通常,当在 Vue 实例上注册事物时,您必须调用 this.$customer 或 this.$models.customer 或类似的名称。您能否提供其余代码以及您是如何使用它的?