如何解决 [vue-hooks] 在 vue 中找不到 vue 实例?
how to solve [vue-hooks] Not found vue instance in vue?
我尝试 运行 this code in codesandbox.io,但出现错误 - 当我点击链接时发生错误:
[Vue warn]: Error in data(): "ReferenceError: [vue-hooks] Not found
vue instance." ReferenceError: [vue-hooks] Not found vue instance.
[Vue warn]: Property or method "product" is not defined on the
instance but referenced during render. Make sure that this property is
reactive, either in the data option, or for class-based components, by
initializing the property. See:
https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.
不确定为什么代码看起来是正确的。
我尝试从我的代码中删除一些片段,似乎 useRouter
是问题所在。但为什么?有什么解决这个问题的想法吗?
让 Vue 使用钩子。
import hooks from "@u3u/vue-hooks";
Vue.use(hooks)
import { useRouter } from "@u3u/vue-hooks"
我尝试 运行 this code in codesandbox.io,但出现错误 - 当我点击链接时发生错误:
[Vue warn]: Error in data(): "ReferenceError: [vue-hooks] Not found
vue instance." ReferenceError: [vue-hooks] Not found vue instance.
[Vue warn]: Property or method "product" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.
不确定为什么代码看起来是正确的。
我尝试从我的代码中删除一些片段,似乎 useRouter
是问题所在。但为什么?有什么解决这个问题的想法吗?
让 Vue 使用钩子。
import hooks from "@u3u/vue-hooks";
Vue.use(hooks)
import { useRouter } from "@u3u/vue-hooks"