Vue调用遇到问题:
报错:
vue.js:659 [Vue warn]: Property or method "message" 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.
(found in <Root>)
解决:
原因是在Html网页div使用了:message属性,并要用vue v-bind绑定了,但是JS没有初始化他。
<div id="app4">
<span style="color: #367ebd; font-weight: bold" v-bind:title="message">
1 鼠标悬停显示当前系统时间
</span>
</div>
解决:JS代码new Vue实现的地方 ,data(){}里设置初始化message的值。
new Vue({
el: '#app4',
data() {
return {
message: '1 页面加载于' + new Date().toLocaleString()
}
}}