template中的时间格式如何修改

1、引用dateformat模块

const dateformat = require('dateformat');

2、在js文件中配置dateformat方法

template.defaults.imports.dateformat = dateformat;

3、将模块文件中的时间参数改为如下格式

<td class="col-xs-1 col-sm-1 col-md-1">{{dateformat($value.enterDate,'yyyy-mm-dd')}}</td>

dateformat方法中的第一个参数为获取的时间

第二个参数为需要修改成的格式

猜你喜欢

转载自www.cnblogs.com/MoonASixpence/p/13198243.html