vue 当前年份
<p>Copyright © 2019<span v-if="getda"> - {{year}}</span> 腾讯科技</p>return {// 当前年year:'',// 默认隐藏getda:false...
·
<p>Copyright © 2019<span v-if="getda"> - {{year}}</span> 腾讯科技</p>
return {
// 当前年
year:'',
// 默认隐藏
getda:false
}
mounted() {
// 调用获取年
this.getCurrentYear()
}
methods: {
// 版权 获取当前年
getCurrentYear() {
let date = new Date();
let y = date.getFullYear();
this.time = y;
if (y > 2020 ) {
this.getda = true
} else {
this.getda = false
}
},
}
更多推荐
已为社区贡献1条内容
所有评论(0)