First, the problem
Vue page by using {{data}} to the value, if the data is a date stamp is taken out.
Second, the solution
Js function date.js defined separately for formatting time, as follows. Date.js incorporated in the page, by {{formatDate (data)}} will be converted to the specified date stamp format.
1 // to the Date object built new method of the Format
2 Date.prototype.Format = function (FMT) {
. 3 var O = {
. 4 "M +": the this .getMonth () + 1, @ January
. 5 "+ D": the this .getDate (), // day
. 6 "H +": the this .getHours (), // h
. 7 "+ m": the this .getMinutes (), // points
. 8 "+ S": the this .getSeconds (), // sec
9 "q+": Math.floor((this.getMonth() + 3) / 3), //季度
10 "S": this.getMilliseconds() //毫秒
11 };
12 if (/(y+)/.test(fmt))
13 fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
14 for (var k in o)
15 if (new RegExp("(" + k + ")").test(fmt))
16 fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
17 return fmt;
18 };
19
20 //工具方法
21 function formatDate(timestramp) {
22 return new Date(timestramp).Format('yyyy-MM-dd');
23 }
FIG date.js effect after use.