0
点赞
收藏
分享

微信扫一扫

gua214.html:16 Uncaught TypeError: watchEffect(...).mount is not a function

芒果六斤半 2022-03-11 阅读 96
<!DOCTYPE html>
<div id="app">
{{ state.count }}
</div>

<script src="https://unpkg.com/vue@next"></script>
<script>
const app = Vue.createApp({});
const { reactive, watchEffect} = Vue;
const state = reactive({
  count:0
})

watchEffect(() => {
  document.body.innerHTML = `count is ${state.count}`
}).mount('#app')
</script>

改:

<!DOCTYPE html>
<div id="app">
{{ state.count }}
</div>

<script src="https://unpkg.com/vue@next"></script>
<script>
const app = Vue.createApp({});
const { reactive, watchEffect} = Vue;
const state = reactive({
  count:0
})

watchEffect(() => {
  document.body.innerHTML = `count is ${state.count}`
})
</script>
举报

相关推荐

0 条评论