:class="{a: true, b: true}"其他
:class="['btn', 'btn2', {a: true, b: false}]"
if(flg === a || flg === b)其他
['a','b'].indexof(flg) > -1
import a from './a.vue' componets: { a }node写法
components: { a: require('./a.vue') }
设置比较长的class类名区分,或者使用ben等命名方法css module
.h3 {}
style样式会存在$style计算属性中
//调用方式
缺点: 生成一个独一无二的class类名,只能使用类名class控制样式scoped
生成hash属性标识.且根元素受父组件的scoped影响
使用>>>深度选择器
//寻找p下的样式,包括子组件样式 p >>> .h3 { }
对象尽量静态化,一旦定义,就不得随意添加新的属性。如果添加属性不可避免,要使用object.assign方法。
// bad const a = {}; a.x = 3; // if reshape unavoidable const a = {}; object.assign(a, { x: 3 }); // good const a = { x: null }; a.x = 3;
如果对象的属性名是动态的,可以在创造对象的时候,使用属性表达式定义。
// bad const obj = { id: 5, name: 'san francisco', }; obj[getkey('enabled')] = true; // good const obj = { id: 5, name: 'san francisco', [getkey('enabled')]: true, //属性表达式 6 };
let arr1 = [1,2,3] let arr2 = [4,6,7] arr2 = arr2.concat(arr1)spread 运算符
let arr1 = [1,2,3] let arr2 = [...arr1,4,6,7]
var a = { key1: 1, key2: 2 } var b = object.assign({}, a, { key3: 3 }) // 最后结果 {key1: 1, key2: 2,key3: 3 }spread 运算符
var a = { key1: 1, key2: 2 } var b = {...a, key3: 3}
使用reset paramete是纯粹的array实例一般
function a() { console.log(arguments) } a(1,2,3)es6
function a(...args) { console.log(args) } a(1,2,3)
ie 任何系列都不支持一般
需要自己写工具函数
es6var arr = [1,2,3] console.log(arr.includes(1)); // true console.log(arr.includes(4)); // false
ie 任何系列都不支持es6
var obj = { key1: 1, key2: 2, key3: 3 } object.keys(obj); // ["key1", "key2", "key3"]
ie 任何系列都不支持es6
var obj = { key1: 1, key2: 2, key3: 3 } object.values(obj); // [1,2,3]
如对本文有疑问, 点击进行留言回复!!
清除新版Google Chrome浏览器中表单控件(input,button...)默认的黑色边框
荐 20200714——git/mac配置/项目运行步骤/一些报错
antd 菜单组件 使用时报错:Cannot read property ‘isRootMenu‘ of undefined
CSS|div的style=“background-image: url(img/a.bmp)图片显示不出来
硬件仪表盘账号建立指导(一) --WHQL认证测试结果提交账号(一)
cookie的规范Cookie的不可跨域名性或Cookie与域名的关系
网友评论