- css module中多個(gè)class帶判斷
div(:class="[$style.content, [fixed == true ? $style.isFixed :'']]")
li(:class="[key == num ? $style.active : '']")
- v-model修飾符
v-model.trim 將用戶輸入的前后的空格去掉
表單中使用
input(placeholder="請(qǐng)輸入手機(jī)號(hào)" type="tel" maxLength="11" v-model.trim="formItem.mobile")
input(placeholder="請(qǐng)輸入驗(yàn)證碼" type="tel" v-model.trim="formItem.captcha" maxLength="6")
- 倒計(jì)時(shí)
span {{time ? `${fullNumber(time)}s`: `${codeText}`}}
data() {
return {
codeText: '獲取驗(yàn)證碼',
},
watch: {
time() {
if(this.time){
setTimeout(() => this.time--, 1000)
}else{
//this.nc.reset();
}
}
}
- data里本地圖片路徑
1.
let shareIcon = require('../assets/shareicon.jpg')
export default {
data() {
return {
appShareOption: {
imgUrl: `${location.origin}${shareIcon}`
}
}
}
}
2.
methods: {
weixin(signPackage) {
var shareOptions = {
imgUrl: `${location.origin}/amvvm/src/invest/imgs/shareicon.jpg`
}
}
}
- 跳轉(zhuǎn)地址帶參數(shù)寫法
location.href=`/amvvm/invest/?unqid=${_this.unqid}&user_key=${_this.user_key}#/result`
- 時(shí)間戳轉(zhuǎn)換
var date = new Date(timestamp * 1000);//時(shí)間戳為10位需*1000请垛,時(shí)間戳為13位的話不需乘1000