1.代码
基于vue进行简单测试,moment.js 也又多语言版本。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="vue.js" type="text/javascript" charset="utf-8"></script>
<script src="moment.js"></script>
</head>
<body>
<div id="app">
<ul>
<li v-for="item,index in items" :key="index">
{{ item.date }}
</li>
</ul>
</div>
<script type="text/javascript">
var app = new Vue({
el: '#app',
data: {
items:[
{date: "MMMM Do YYYY, h:mm:ss a: " + moment().format("MMMM Do YYYY, h:mm:ss a")},
{date: "yyyy-MM-DD HH:mm:ss: " + moment().format("yyyy-MM-DD HH:mm:ss")},
{date: "yyyy-MM-DD: " + moment().format("yyyy-MM-DD")},
{date: "yyyyMMDD: " + moment().format("yyyyMMDD")},
{date: "YYMMDD: " + moment().format("YYMMDD")},
{date: "llll: " + moment().format("llll")},
{date: "LLL: " + moment().format("LLL")},
{date: "yy: " + moment().format("yy")},
{date: "DD: " + moment().format("DD")},
{date: "dd: " + moment().format("dd")},
]
}
});
</script>
</body>
</html>