当前所在observable/index.js
import Vue from 'vue'
export const store = Vue.observable({
name: '来了老弟'
})
export const mutations = {
setName(data) {
store.name = data
}
}
{{name}}
<el-button @click='clickButton'>按钮</el-button>
import { store, mutations } from './observable'
methods:{
clickButton() {
mutations.setName('(#`O′)')
}
},
computed: {
name() {
return store.name
}
}