其他分享
首页 > 其他分享> > gua214.html:16 Uncaught TypeError: watchEffect(...).mount is not a function

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

作者:互联网

<!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>

标签:function,...,TypeError,const,reactive,count,watchEffect,state,Vue
来源: https://blog.csdn.net/weixin_40945354/article/details/123226754