页面效果:
文章来源地址https://www.toymoban.com/news/detail-576309.html
<template>
<view class="order-intro-item">
<text class="left-label">日期</text>
<text class="right-info time-text">{{startClearingTime | formatData}} 至 {{endClearingTime | formatData}}</text>
</view>
</template>
<script>
export default {
data() {
return {
startClearingTime:"2023-07-12 16:00",
endClearingTime :"2023-07-12 16:00"
}
},
computed: {
},
// 格式化日期
filters: {
formatData() {
const date = new Date();
// let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
let hour = date.getHours();
let minute = date.getMinutes();
month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day;
hour = hour > 9 ? hour : '0' + hour;
return `${month}-${day} ${hour}:00`;
},
},
文章来源:https://www.toymoban.com/news/detail-576309.html
到了这里,关于uniapp 小程序 filters 过滤日期的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!