Start
install
npm install vue-modello --save
安装 Vue 插件,注册 model
src/app/modello.js
import Vue from 'vue'
import VueModello from 'vue'
let appModello = new VueModello()
// 安装插件
Vue.use(appModello)
// 注册 models
import models from 'src/models/index'
models.forEach(m => appModello.reg(m))
export default appModello
在 Component.vue 中使用 VueModello
component.vue
<template>
...
</template>
<script>
import 'appModello' from 'src/app/modello'
export default {
modello: [{
model: 'Product'
}],
created () {
this.$model.queryProductList()
}
}
</script>
查看 modello 选项说明