vue v-time指令封装(接口返回时间戳 在到日期转换)


// 全局时间戳转换指令注册
Vue.directive('time',{
bind: function (el,binding) {
let getTime = new Date(binding.value)
el.innerHTML = `${getTime.getFullYear()}-${getTime.getMonth()+1}-${getTime.getDate()}`;
}
})


// 使用v-time
<td v-time="inputDate"></td> // inputDate为接口返回日期字段名,非固定
原文:https://blog.csdn.net/weixin_40402681/article/details/85230447


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM