01 2021 档案
摘要:<script> export default { data () { return { item: ['张三','李四','小明'] } }, // 在组件中使用,去除组件中的template标签 (组件中的template标签中的内容编译时最终都会编译成render函数) // createEl
阅读全文
摘要:官方文档:https://cn.vuejs.org/v2/api/#Vue-extend vue.extend使用基础 Vue 构造器,创建一个“子类”。参数是一个包含组件选项的对象。 extend是产生一个继承自Vue类的子类,只会影响这个子类的实例对象,不会对Vue类本身以及Vue类的实例对象产
阅读全文
摘要:组件渲染过程 template --> ast --> render --> 虚拟Dom--> 真实的Dom --> 页面 runtime-only 我们在使用 runtime-only 的时候,需要借助 webpack的loader工具,将 .vue 文件编译为JavaScript,因为是在编译阶
阅读全文
摘要:新建一个bus.js文件,并在main.js引入并全局使用它 import Vue from 'vue' const bus = new Vue({ data: { number: 1 } }) export default { install() { Object.defineProperty(V
阅读全文
摘要:创建一个message.vue组件 <template> <transition name="message-transition"> <div v-show="show" class="message"> <div class="message-content">{{ content }}</di
阅读全文
摘要:/* 固定用法, 多行溢出显示省略号,最好不要设置height,让height自适应 */ .div { overflow: hidden; text-overflow: ellipsis; white-space: normal !important; display: -webkit-box;
阅读全文
摘要:function getRandomInt(min,max) { return Math.floor(Math.random() * (max - min + 1) + min) // return Math.floor(Math.random() * (max + 1)) } // 洗牌函数(数组
阅读全文
浙公网安备 33010602011771号