摘要: // mixin 混入 // 组件 data,methods 优先级高于 mixin 里面的 data , methods优先级 // 生命周期函数 先执行 mixin 里面的,再执行组件里面的 const myMixin = { data(){ return { number:2, count: 阅读全文
posted @ 2021-12-07 17:11 13522679763-任国强 阅读(101) 评论(0) 推荐(0)
摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="wi 阅读全文
posted @ 2021-12-07 15:36 13522679763-任国强 阅读(24) 评论(0) 推荐(0)
摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="wi 阅读全文
posted @ 2021-12-07 15:19 13522679763-任国强 阅读(16) 评论(0) 推荐(0)
摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="wi 阅读全文
posted @ 2021-12-07 15:18 13522679763-任国强 阅读(25) 评论(0) 推荐(0)
摘要: <script> // v-once 让某个元素标签只渲染一次 // ref 获取 DOM节点/组件引用 的语法 this.$refs.xxx / this.$refs.common.sayHello() // provide / inject 跨组件 多级传递参数 var app = Vue.cr 阅读全文
posted @ 2021-12-07 11:06 13522679763-任国强 阅读(22) 评论(0) 推荐(0)
摘要: <script> // 异步组件: 异步执行某些组件的逻辑 var app = Vue.createApp({ template:` <div> <common-item /> <async-common-item /> </div> `, }) app.component('common-item 阅读全文
posted @ 2021-12-07 10:32 13522679763-任国强 阅读(42) 评论(0) 推荐(0)
摘要: // 动态组件: 根据数据的变化 结合 component 这个标签,来随时切换组件的显示 var app = Vue.createApp({ data(){ return { currentItem:'input-item' } }, methods:{ handleClick(){ if(thi 阅读全文
posted @ 2021-12-07 10:11 13522679763-任国强 阅读(64) 评论(0) 推荐(0)
摘要: <script> // 当子组件渲染的内容需要父组件 决定的时候 使用 var app = Vue.createApp({ template:` <list v-slot="slotProps"> <p>{{slotProps.item}}</p> </list> `, }) app.compone 阅读全文
posted @ 2021-12-07 09:47 13522679763-任国强 阅读(31) 评论(0) 推荐(0)
摘要: var app = Vue.createApp({ template:`<div> <myform> <div>提交</div> </myform> <myform> <button @Click="handleClick"> 提交</button> </myform> <myform> </myf 阅读全文
posted @ 2021-12-07 09:31 13522679763-任国强 阅读(35) 评论(0) 推荐(0)