代码拉取完成,页面将自动刷新
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.14/vue.min.js"></script>
</head>
<body>
<h3>013.html</h3>
<div id="app">
<div v-for="item in list">
{{item.id}} -- {{item.name}} -- {{item.birthday}} -- {{item.birthday | foo}}
</div>
</div>
<div id="app2">
{{msg | foo}}
</div>
<script>
let app = new Vue({
el: "#app",
data: {
list:[
{id:1, name:"关羽", birthday:"2011-11-11"},
{id:2, name:"张飞", birthday:"2001-11-11"},
{id:3, name:"赵云", birthday:"2015-12-11"},
{id:4, name:"马超", birthday:"2013-1-11"},
{id:5, name:"黄忠", birthday:"2014-11-1"},
]
},
methods: {
},
filters: {
foo(val) {
let dd = new Date(val);
console.log(dd);
return dd.getFullYear() + "/" + (dd.getMonth()+1) + "/" + dd.getDate() + "~~~";
}
}
});
let app2 = new Vue({
el: "#app2",
data: {
msg:"2008-8-8"
}
});
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。