亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

2-5計算屬性

使用計算屬性實現日期的格式化,只顯示年月日

這個要怎么弄呢?

求大神幫忙。。。

正在回答

2 回答

<!DOCTYPE?html><html?lang="en"><head><meta?charset="UTF-8"?/><meta?name="viewport"?content="width=device-width,?initial-scale=1.0"?/><title>Document</title><script?src="./vue.js"></script></head><body><div?id="app"></div><script>new?Vue({el:?"#app",template:?"<h1>{{fullDate}}</h1>",computed:?{fullDate:?function?()?{let?now?=?new?Date();let?year?=?now.getFullYear();let?month?=?now.getMonth();let?date?=?now.getDate();return?`${year}-${month}-${date}`;?//根據自己的需要拼接字符串},},});</script></body></html>


0 回復 有任何疑惑可以回復我~
#1

慕木暮目 提問者

真乃大神也!
2020-09-22 回復 有任何疑惑可以回復我~

<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Document</title><script src="./vue.js"></script></head><body><div id="app"></div><script>new Vue({el: "#app",template: "<h1>{{fullDate}}</h1>",computed: {fullDate: function () {let now = new Date();let year = now.getFullYear();let month = now.getMonth();let date = now.getDate();return `${year}-${month}-${date}`; //根據自己的需要拼接字符串},},});</script></body></html>

01

1 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

2-5計算屬性

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號