說明:html
<!-- 下面這行代碼沒法正常工做 --> <img v-show="IDcard" :src="IDcard" alt=""> <!-- 替代方案 --> <img v-if="IDcard" :src="IDcard" alt="">
場景:vue
解釋:ios
官方說明文檔原生組件說明canvas
舉例說明:axios
解決辦法:小程序
實際例子:服務器
注意事項:app
頁面路由框架
說明:iphone
<textarea v-model="desc" class="inp" placeholder="" auto-focus v-if="focusFlag" @blur="hideTextarea"></textarea> <p v-else-if="!focusFlag && desc" class="textarea-replace" @click="showTextarea">{{desc}}</p> <p v-else class="textarea-replace no-desc" @click="showTextarea">請介紹一下本身的性格特色、工做經歷,描述下本身擅長作的事情</p>
export default { data () { desc: '', focusFlag: true }, methods: { hideTextarea () { this.focusFlag = false }, showTextarea () { this.focusFlag = true } } }
解釋:
說明:
new
Date(date).getTime(),
用這個方法來獲取時間戳時,iphone手機上打印出的時間戳爲NaNnew Date(date).getTime()方法沒法在iphone手機上獲取到對應的時間戳
解決方案:
講解:
坑點:
data () { return { timer: null } }, onLoad (e) { this.demandId = e.id this.getDemandDetail() }, onUnload () { clearInterval(this.timer) Object.assign(this.$data, this.$options.data()) }, methods: { getDemandDetail() { // axios請求拿到詳情數據後 getDetail(this.demandId).then(res => { // 在接口中獲取到截止時間和服務器的當前時間 this.runTimer(res.data.deadline, res.data.systemDate) }) }, runTimer (deadline, systemDate) { deadline = deadline.replace(/-/g, '/') systemDate = systemDate.replace(/-/g, '/') let totalSeconds = parseInt((new Date(deadline).getTime() - new Date(systemDate).getTime()) / 1000) this.timer = setInterval(() => { const hours = parseInt(totalSeconds / 60 / 60) > 0 ? parseInt(totalSeconds / 60 / 60) : 0 const minutes = parseInt((totalSeconds - hours * 3600) / 60) > 0 ? parseInt((totalSeconds - hours * 3600) / 60) : 0 const seconds = parseInt(totalSeconds - hours * 3600 - minutes * 60) > 0 ? parseInt(totalSeconds - hours * 3600 - minutes * 60) : 0 // 計算出時分秒並賦值給顯示區域 this.countTime.hours = hours < 10 ? '0' + hours : hours this.countTime.minutes = minutes < 10 ? '0' + minutes : minutes this.countTime.seconds = seconds < 10 ? '0' + seconds : seconds // 當秒數小於零時銷燬計時器,不然秒數-1 if (totalSeconds <= 0) { this.countdownEnd = true clearInterval(this.timer) this.timer = null } else { totalSeconds-- } }, 1000) } }
關鍵代碼: