Closed yee94 closed 6 years ago
<template> <div class = "overlook-setting"> {{testMobx.data}} </div> </template> <script> import { Component, Vue } from 'vue-property-decorator' import { observable, action } from 'mobx' class TestMobx { constructor() { } @observable data = 9 @action.bound setData() { this.data++ } } let TestClass = new TestMobx() @Component export default class OverlookSetting extends Vue { testMobx = TestClass mounted() { this.testMobx.setData() this.testMobx.data++ console.log(this.testMobx.data) } beforeDestroy() { } } </script> <style lang = "less" scoped> .overlook-setting { } </style>
当我运行上面这段代码的时候打印出来的数据是10 ,但Dom还是9
Vue版本2.5.16 ,Mobx版本4.3.1
对不起,我的问题。。。没有引入你的库
想问下,你用vue-property-decorator这个装饰库,会报 The "data" option should be a function that returns a per-instance value in component definitions. 的warning吗?
The "data" option should be a function that returns a per-instance value in component definitions.
当我运行上面这段代码的时候打印出来的数据是10 ,但Dom还是9
Vue版本2.5.16 ,Mobx版本4.3.1