在 入口文件中写一个 全局的过滤器
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20//在 入口文件写一个全局日期时间过滤器 Vue.filter('过滤器名称', function(sisui) { const dt = new Date(sisui) const y = dt.getFullYear() const m = (dt.getMonth() + 1 + '').padStart(2, '0') const d = (dt.getDate() + '').padStart(2, '0') const hh = (dt.getHours() + '').padStart(2, '0') const mm = (dt.getMinutes() + '').padStart(2, '0') const ss = (dt.getSeconds() + '').padStart(2, '0') return `${y}-${m}-${d} ${hh}-${mm}-${ss}` }) //第二步 <el-table-column label="创建时间" prop='请求回来的时间数据名字' width="110" align="center"> <template slot-scope="scope"> {{ scope.row.请求回来的时间数据名字 | 过滤器名称 }} </template> </el-table-column>
最后
以上就是无情煎饼最近收集整理的关于时间格式过滤器在 入口文件中写一个 全局的过滤器的全部内容,更多相关时间格式过滤器在内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复