In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "vue how to format the time in the element table for the specified format", in the daily operation, I believe that many people have doubts about how to format the time in the vue element table for the specified format. Xiaobian consulted all kinds of data and sorted out a simple and easy-to-use method of operation. I hope it will be helpful for you to answer the question of "how to format the time in the element table in vue". Next, please follow the editor to study!
In the vue table, if you bind the time field directly, the default display format is generally: yyyy-MM-dd HH:mm:ss, but sometimes you only need to display the year, month, day, or time, minute and second, then we can use the filter (filter).
The basic vue table is written using filter {{scope.row.date | FormatDate ('HH:mm:ss')}}
Here, time is converted into year: month: day format
How filters are defined: define a time filter in main.js / / main.jsfunction formatDate (date, fmt) {date = new Date (date); if (typeof (fmt) = "undefined") {fmt = "yyyy-MM-dd HH:mm:ss" } if (/ (y +) / .test (fmt)) {fmt = fmt.replace (RegExp.$1, (date.getFullYear () +'). Substr (4-RegExp.$1.length))} let o = {'date.getMonth () + 1,' dumped: date.getDate (), 'Hathaway: date.getHours (),' masks: date.getMinutes () Date.getSeconds ()} for (let k in o) {if (new RegExp (`(${k})`) .test (fmt)) {let str = o [k] +''fmt = fmt.replace (RegExp.$1, RegExp.$1.length = 1? Str: ('00' + str) .substr (str.length);}} return fmt}; / / define a time filter Vue.filter ("FormatDate", function (date, fmt) {return formatDate (date, fmt);}); at this point, the study on "how vue formats the time in the element table to a specified format" is over, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.