摘要: 有时候弹窗或者一些特殊的区域需要自定义一些html元素来显示(snabbdom) const h = this.$createElement this.$msgbox({ title: '提示', message: h('p', null, [ h('p', null, 'YYYYYYYYYYYYY 阅读全文
posted @ 2020-07-21 23:57 荣光无限 阅读(1959) 评论(0) 推荐(0) 编辑
摘要: 在不用VueCli创建项目的时候,手写引入vue的时候,配置webpack的时候发现了这个问题 webpack vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin 这是因 阅读全文
posted @ 2020-07-21 23:54 荣光无限 阅读(3653) 评论(0) 推荐(0) 编辑
摘要: 🚀 内联模板不会把子组件的内容分发渲染到父组件中 🚀 而是需要在父组件中实现其内容的渲染 父组件 <template> <div> <template-inline inline-template> <!-- 🚀只能有一个根元素 --> <div> <div>{{msg}}</div> <!- 阅读全文
posted @ 2020-07-21 23:52 荣光无限 阅读(3469) 评论(0) 推荐(0) 编辑
摘要: 🚀 Vue.use Vue.use 的作用是安装插件 Vue.use 接收一个参数 如果这个参数是函数的话,Vue.use 直接调用这个函数注册组件 如果这个参数是对象的话,Vue.use 将调用 install 方法来注册组件 * 官方文档: * Vue.use 用于安装 Vue.js 插件。 阅读全文
posted @ 2020-07-21 23:48 荣光无限 阅读(494) 评论(0) 推荐(0) 编辑
摘要: 😜 主要是思路,自己定义组件的时候可以借鉴 😜 🚀 Vue-router的 类图 name options: ==> 记录构造函数中传入的对象,在 new VueRouter的时候传了一个对象( routes :路由规则) data: ==> 有个属性 current (记录当前路由地址的), 阅读全文
posted @ 2020-07-21 23:44 荣光无限 阅读(941) 评论(0) 推荐(0) 编辑
摘要: 设置 CSS .container{ overflow:auto; } img{ width:100%; height:auto; overflow:hidden; } 设置 template <div class="container"> <img :src="src"> </div> 设置 sc 阅读全文
posted @ 2020-07-21 23:41 荣光无限 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 安装依赖包 npm install jsbarcode --save 😄 在使用页面引入依赖包 import JsBarcode from 'jsbarcode' 定义img标签和id <img id="barcode" /> 在使用页面开始生成,可以写在方法中或者mounted中 JsBarco 阅读全文
posted @ 2020-07-21 23:39 荣光无限 阅读(5107) 评论(0) 推荐(0) 编辑
摘要: 如果定义样式的时候,内层样式名称和外层保持一致的话可以简写如下 如果一个样式下有相关的其他样式可以使用 &-xxx 来简写, <template> <div class="test-container"> <div class="test-container-header">header</div> 阅读全文
posted @ 2020-07-21 23:37 荣光无限 阅读(3429) 评论(0) 推荐(0) 编辑
摘要: 一般使用场景: 登录的错误验证 或者 强提醒 template 部分 <img id="barcode" :class="{ shaking: toShake}" @click="handleShake" /> javascript 部分 export default { data(){ retur 阅读全文
posted @ 2020-07-21 23:33 荣光无限 阅读(1535) 评论(0) 推荐(0) 编辑
摘要: 如果Vue文件需要很多的data成员及表单验证,建议使用类似结构 export default{ data(){ const model = { username: 'suzhen', password: '12345678' } const rules = { username: [ { requ 阅读全文
posted @ 2020-07-21 23:31 荣光无限 阅读(887) 评论(0) 推荐(0) 编辑
摘要: 页面需要水印 import Vue from 'vue' /** * watermark 指令 * 解决: 给页面生成水印 * 基本原理:给选择器添加背景图片 * 用法:v-watermark="{options}" * option: * @param {string} text 水印文字 * @ 阅读全文
posted @ 2020-07-21 23:29 荣光无限 阅读(1064) 评论(0) 推荐(0) 编辑
摘要: 注意事项 如果导出的页面中设计到图片或者其他文件跨域文件,需要后端服务配合 安装依赖 npm install html2Canvas --save npm install jspdf--save 封装Class // 导出页面为PDF格式 import html2Canvas from 'html2 阅读全文
posted @ 2020-07-21 23:25 荣光无限 阅读(764) 评论(0) 推荐(0) 编辑
摘要: 防抖函数 触发高频事件后,n秒内函数只会执行一次,如果n秒内高频事件再次被触发,则重新计算时间 函数防抖是在频繁触发后,只执行一次(两者的前提都是频繁触发),下拉框输入查询 / 频繁的点赞/取消点赞 /** * * @param {*} fn :callback function * @param 阅读全文
posted @ 2020-07-21 23:21 荣光无限 阅读(198) 评论(0) 推荐(0) 编辑
摘要: template <div class="each-one-in-list"> <div class="show-icon">进行中</div> <div class="show-signal"></div> <div class="main-title" title="test"> <strong 阅读全文
posted @ 2020-07-21 23:20 荣光无限 阅读(2605) 评论(0) 推荐(0) 编辑
摘要: 子组件代码 // 子组件 validateForm() { return new Promise((resolve, reject) => { this.$refs.contractBaseRef.validate((valid) => { if (valid) { resolve(this.get 阅读全文
posted @ 2020-07-21 23:17 荣光无限 阅读(1399) 评论(0) 推荐(0) 编辑
摘要: 不带原型的对象,纯对象 const plaintObject = Object.create(null) 带原型的对象 const originObject = new Object() 阅读全文
posted @ 2020-07-21 23:15 荣光无限 阅读(517) 评论(0) 推荐(0) 编辑
摘要: Blob Binary Large Object的缩写,二进制大对象 虽然在前端中开发并不常见,但是实际上MySql数据库中,可以通过设置一个Blob类型的数据来存储一个Blob对象的内容 语法 let blob = new Blob(Array,options) // 参数Array: 是由一个` 阅读全文
posted @ 2020-07-21 17:51 荣光无限 阅读(1073) 评论(0) 推荐(0) 编辑
摘要: 使用 ES2019中的新特性 Array.prototype.flat() const arr = [1,2,3,4,[10,20,30]] const res = arr.flat() console.info(res) // [1,2,3,4,10,20,30] 使用 reduce, 递归数组 阅读全文
posted @ 2020-07-21 16:59 荣光无限 阅读(159) 评论(0) 推荐(0) 编辑
摘要: async 作用: async函数返回一个 Promise对象,无论内部有没有await关键字. await 作用: await等待的是一个表达式,这个表达式的计算结果是 Promise 对象 或者是其他值 (await可以等待任意表达式的结果) 如果await的不是一个Promise对象, 那 a 阅读全文
posted @ 2020-07-21 10:18 荣光无限 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 作用: 改变函数执行时的作用域 let name = 'global name' function say(){ console.info(arguments) // 调用时接收的参数个数 console.info(this.name) } var obj = { name: 'obj name' 阅读全文
posted @ 2020-07-21 09:33 荣光无限 阅读(109) 评论(0) 推荐(0) 编辑