摘要: map /** * 语法: * var new_array = arr.map(function callback(currentValue[,index[,array]]){ * // return element for new_array * }[,thisArg]) */ callback: 阅读全文
posted @ 2020-07-22 23:58 荣光无限 阅读(120) 评论(0) 推荐(0) 编辑
摘要: let setTimeout = (sec, num) => { // 初始当前时间 const now = new Date().getTime() let flag = true let count = 0 while (flag) { count++ // 再次运行时获取当前时间 const 阅读全文
posted @ 2020-07-22 23:50 荣光无限 阅读(814) 评论(0) 推荐(0) 编辑
摘要: call 和 apply 作用: 都是为了改变某个函数运行的context上下文而存在的,为了改变函数体内部 this的指向 JavaScript函数存在定义时上下文和运行时上下文, 上下文(context)是可以改变的 call 和 apply 作用完全一致,区别在于接收参数的方式不同 call的 阅读全文
posted @ 2020-07-22 23:31 荣光无限 阅读(288) 评论(0) 推荐(0) 编辑
摘要: 1. 不好的方式 很长时间以来都是用改写form-item样式来使得必填项和非必填项保证label对齐,这样需要改写系统样式,还要在相应的item上引用,代码量增多,示例如下(不推荐) <template> <el-form-item prop="name" label="名称" class="fo 阅读全文
posted @ 2020-07-22 11:22 荣光无限 阅读(7395) 评论(0) 推荐(0) 编辑
摘要: 我们经常会在某个table末尾加上操作列来放置button来处理跳转和其他的逻辑 那么当点击button的时候同样也会执行在el-table 设置的 @row-click="handleRowClick"事件。如果避免这种情况呢? 其实很简单,在操作列的加上@click.stop就可以了 <el-t 阅读全文
posted @ 2020-07-22 11:21 荣光无限 阅读(1930) 评论(0) 推荐(0) 编辑
摘要: Vue中监听某个对象的属性 为了避免监听整个对象导致效率问题,可以监听某个对象的特定属性 watch: { 'deptModel.depts': { handler(newVal, oldVal) { if (oldVal.length == 4 && newVal.length == 5) { t 阅读全文
posted @ 2020-07-22 11:20 荣光无限 阅读(453) 评论(0) 推荐(0) 编辑
摘要: Vue中过滤器(filter)的功能高度提取,便于使用,前端小伙伴们使用的频率很高.但大多数都是在模板区域来使用。 如果要在脚本区域, 也就是来使用已经定义好过滤器功能,该如何去做呢? 难道需要在utils/下写一个filter.js的文件来同步过滤器的功能吗?这样的话重复代码有点多啊。 以下就是如 阅读全文
posted @ 2020-07-22 11:19 荣光无限 阅读(925) 评论(1) 推荐(0) 编辑
摘要: git-cz官网 0.目的 ⇒ 替代git commit, 丰富提交的内容 1.安装包 npm install commitizen cz-conventional-changelog --save-dev 2.修改package.json "scripts": { "dev": "webpack- 阅读全文
posted @ 2020-07-22 11:17 荣光无限 阅读(1052) 评论(0) 推荐(0) 编辑
摘要: 1.严格模式 import getters from './getters' import mutations from './mutations' import actions from './actions' export default new Vuex.Store({ strict: tru 阅读全文
posted @ 2020-07-22 11:14 荣光无限 阅读(697) 评论(0) 推荐(0) 编辑
摘要: 常规情况下,在里动态加载不同组件的方式为: <template> <!-- 符合条件A,加载组件A --> <BusinessComponentA v-if="condition==''A" /> <!-- 符合条件B,加载组件B --> <BusinessComponentB v-if="cond 阅读全文
posted @ 2020-07-22 11:11 荣光无限 阅读(5816) 评论(0) 推荐(0) 编辑
摘要: 在实际的开发过程中,给表单元素绑定model的时候,绑定的元素的属性是根据后台数据动态生成的。如果使用常规的赋值方式,是无法更新视图的 需要使用, this.$set(dataName,keyName,keyValue) export default { data:{ // 先定义一个空对象 for 阅读全文
posted @ 2020-07-22 11:10 荣光无限 阅读(5279) 评论(0) 推荐(0) 编辑
摘要: 子组件vue <template> <div> <slot v-if="slots.header" name="header"></slot> <slot></slot> <slot name="footer"></slot> </div> </template> <script> export d 阅读全文
posted @ 2020-07-22 11:07 荣光无限 阅读(1498) 评论(0) 推荐(0) 编辑
摘要: 官方链接 https://cn.vuejs.org/v2/guide/components-custom-events.html#sync-修饰符 这个解释有点不太直观,用代码解释一下 ####父组件 v-bind:msg.sync="testMsg" <template> <div> <bizCo 阅读全文
posted @ 2020-07-22 11:05 荣光无限 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 父组件使用子组件时,使用v-model指令,在子组件中使用value获取props的值 父组件 <template> <div style="margin:20px;display:flex;align-items:center;"> <!-- 🚀 给子组件绑定v-model --> <bizCo 阅读全文
posted @ 2020-07-22 11:03 荣光无限 阅读(7683) 评论(0) 推荐(0) 编辑
摘要: 目的:插槽内容能够访问子组件中才有的数据是很有用的 父组件 <template> <div> <h1>作用域插槽: 绑定在<slot>;元素上的attribute被称为插槽Prop</h1> <slot-context> <h3>默认插槽: defalut slot content</h3> <!- 阅读全文
posted @ 2020-07-22 11:02 荣光无限 阅读(256) 评论(0) 推荐(0) 编辑
摘要: 同级目录下 文件1 // exportByModule.js const hello_1 = () => { console.info('hello_1') } const hello_2 = () => { console.info('hello_2') } module.exports = { 阅读全文
posted @ 2020-07-22 10:59 荣光无限 阅读(1359) 评论(0) 推荐(0) 编辑
摘要: babel插件只是去唤醒 @babel/core中的转换过程 转换模块需要手动安装 npm install @babel/core 转换方式需要安装 @babel/preset-env babel默认只是ECMASCript的转换平台,平台是不做任何事情的,只是提供一个环境,具体工作的babel内部 阅读全文
posted @ 2020-07-22 10:57 荣光无限 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 定义一个带参数和默认值的mixin class // demo.scss @mixin button($background:#606266) { font-size: 1em; padding: 0.5em 1.0em; text-decoration: none; color: #fff; ba 阅读全文
posted @ 2020-07-22 10:43 荣光无限 阅读(661) 评论(0) 推荐(0) 编辑
摘要: class【serious-error】会继承 【error】的所有属性 .error { border: 1px solid red; background-color: #fdd; } .serious-error { @extend .error; font-size: 24px; } 阅读全文
posted @ 2020-07-22 10:41 荣光无限 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 屏幕宽度 小于等于 500px时 ⇒ #409EFF 屏幕宽度 大于 500px && 小于1024px时 ⇒ #67C23A 屏幕宽度 大于等于 1024px时 ⇒ #F56C6C @media (max-width: 500px) { .container { background: #409E 阅读全文
posted @ 2020-07-22 10:38 荣光无限 阅读(818) 评论(0) 推荐(0) 编辑