日照项目的居民端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

45 lines
807 B

import dateFormat from "@npm/dai-mp/tools/dateFormat.js";
// 顶部tab切换组件
Component({
properties: {
format: {
type: String,
value: "yyyy-MM-dd",
},
timestamp: {
type: String,
value: "",
},
},
data: {
showText: "",
},
observers: {
timestamp(val) {
this.computeShowText();
},
},
lifetimes: {
ready() {
this.init();
},
},
methods: {
init() {
// console.log("日期显示组件初始化完成");
},
computeShowText() {
const { timestamp, format } = this.data;
const showText = dateFormat(new Date(timestamp * 1000), format);
// console.log("日期显示组件", showText);
this.setData({ showText });
},
},
});