1.特殊字体在css中怎么用

1
2
3
4
5
6
7
@font-face { 
font-family: tszt; /*这里是说明调用来的字体名字*/
src: url('./tszt.ttf'); /*这里是字体文件路径*/
}
.a {
font-family: tszt
}

2.禁止页面缩放,user-scalable

1
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0, user-scalable=no;">

3.img标签的object-fit

4.webpack分析打包的插件webpack-bundle-analyzer

1
2
3
4
5
6
7
8
// 基本配置
# yarn add webpack-bundle-analyzer
// vue.config.js
chainWebpack: config => {
config
.plugin('webpack-bundle-analyzer')
.use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin,[])
}

5.vue中使用v-model封装组件

相当于:value=”” @input=””

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
在子组件中如下使用
props: {
mypass: String,
},
model: { // 不写model的话就是默认
prop: 'mypass', // 默认是value
event: 'myevent' // 默认是input
},
created() {
console.log('myevent', this.mypass);
},
methods: {
change() {
this.$emit('myevent', 'pass1')
}
}