摘要: created() { this.$watch("message", (newValue, oldValue) => { console.log("message数据变化:", newValue, oldValue) }, { deep: true }) } 阅读全文
posted @ 2022-08-16 18:26 杨建鑫 阅读(18) 评论(0) 推荐(0)
摘要: watch: { // 默认watch监听不会进行深度监听 -- 简写模式 info(newValue, oldValue) { console.log("侦听到info改变:", newValue, oldValue) }, // 进行深度监听 -- 原始模式 info: { handler(ne 阅读全文
posted @ 2022-08-16 18:25 杨建鑫 阅读(130) 评论(0) 推荐(0)
摘要: // 完整的写法: fullname: { get: function() { return this.firstname + " " + this.lastname }, set: function(value) { const names = value.split(" ") this.firs 阅读全文
posted @ 2022-08-16 18:24 杨建鑫 阅读(50) 评论(0) 推荐(0)
摘要: <body> <div id="app"> <!-- 1.普通的html写法 --> <h2 style="color: red; font-size: 30px;">哈哈哈哈</h2> <!-- 2.style中的某些值, 来自data中 --> <!-- 2.1.动态绑定style, 在后面跟上 阅读全文
posted @ 2022-08-16 14:50 杨建鑫 阅读(188) 评论(0) 推荐(0)
摘要: <body> <div id="app"> <!-- 1.基本绑定class --> <h2 :class="classes">Hello World</h2> <!-- 2.动态class可以写对象语法 --> <button :class=" isActive ? 'active': '' " 阅读全文
posted @ 2022-08-16 14:49 杨建鑫 阅读(124) 评论(0) 推荐(0)
摘要: <body> <div id="app"> <div v-memo="[name, age]"> <h2>姓名: {{ name }}</h2> <h2>年龄: {{ age }}</h2> <h2>身高: {{ height }}</h2> </div> <button @click="updat 阅读全文
posted @ 2022-08-16 14:48 杨建鑫 阅读(38) 评论(0) 推荐(0)