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.
57 lines
1.0 KiB
57 lines
1.0 KiB
5 years ago
|
Component({
|
||
|
externalClasses: ['class'],
|
||
|
|
||
|
properties: {
|
||
|
info: String,
|
||
|
type: String,
|
||
|
size: {
|
||
|
type:Number,
|
||
|
value: 23
|
||
|
},
|
||
|
fontsize:{
|
||
|
type:Number
|
||
|
},
|
||
|
color: {
|
||
|
type:String,
|
||
|
value:"inherit"
|
||
|
},
|
||
|
showtype:{
|
||
|
type:String,
|
||
|
value:"default"
|
||
|
},
|
||
|
duration:{
|
||
|
type:Number,
|
||
|
value:1500
|
||
|
}
|
||
|
},
|
||
|
|
||
|
methods: {
|
||
|
onTap() {
|
||
|
let {info, showtype, duration} = this.data;
|
||
|
if(info){
|
||
|
if(showtype=='toast')
|
||
|
wx.showToast({
|
||
|
title: info,icon:"none", duration
|
||
|
})
|
||
|
else if(showtype=='modal')
|
||
|
wx.showToast({
|
||
|
title: info, showCancel:false,duration
|
||
|
})
|
||
|
else
|
||
|
this.showInfo()
|
||
|
}
|
||
|
},
|
||
|
showInfo(){
|
||
|
if (this.timeid)
|
||
|
clearTimeout(this.timeid);
|
||
|
this.setData({showInfo:1});
|
||
|
this.timeid = setTimeout(() => {
|
||
|
this.hideInfo();
|
||
|
},this.data.duration);
|
||
|
},
|
||
|
hideInfo(){
|
||
|
this.setData({showInfo:0});
|
||
|
this.timeid = null;
|
||
|
}
|
||
|
}
|
||
|
});
|