【发布时间】:2021-01-19 22:40:46
【问题描述】:
模板:
<div>
<label class="label">balance</label>
<h3 class="title is-4">${{ lobby.balance }}</h3>
</div>
代码:
setup() {
const state = reactive({
lobby: {},
});
state.lobby = new Lobby(); //settimeout change balance in constructor is not re-render
setTimeout(() => {
state.lobby.balance = 123; // re-render is work
}, 1000);
return {
...toRefs(state),
};
}
为什么Lobby 构造函数中的balance 更改没有反应?
【问题讨论】:
标签: typescript vue.js vuejs3 vue-composition-api