mirror of
https://git.beihong.wang/wangbeihong/iot-bedroom-environment-controller.git
synced 2026-04-27 22:29:46 +08:00
增加补充相关资料和小程序源码
This commit is contained in:
70
微信小程序源码/iot-home/components/firstui/fui-toast/fui-toast.js
Normal file
70
微信小程序源码/iot-home/components/firstui/fui-toast/fui-toast.js
Normal file
@@ -0,0 +1,70 @@
|
||||
Component({
|
||||
properties: {
|
||||
padding: {
|
||||
type: String,
|
||||
value: '32rpx'
|
||||
},
|
||||
background: {
|
||||
type: String,
|
||||
value: 'rgba(0,0,0,.6)'
|
||||
},
|
||||
width: {
|
||||
type: Number,
|
||||
optionalTypes: [String],
|
||||
value: 64
|
||||
},
|
||||
size: {
|
||||
type: Number,
|
||||
optionalTypes: [String],
|
||||
value: 30
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
value: '#fff'
|
||||
},
|
||||
zIndex: {
|
||||
type: Number,
|
||||
value: 1001
|
||||
}
|
||||
},
|
||||
data: {
|
||||
timer: null,
|
||||
src: '',
|
||||
text: '',
|
||||
visible: false
|
||||
},
|
||||
lifetimes: {
|
||||
detached: function () {
|
||||
clearTimeout(this.data.timer);
|
||||
this.data.timer = null;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
show(options) {
|
||||
clearTimeout(this.data.timer);
|
||||
let {
|
||||
duration = 2000,
|
||||
src = '',
|
||||
text = ''
|
||||
} = options;
|
||||
this.setData({
|
||||
text: text,
|
||||
src: src
|
||||
}, () => {
|
||||
setTimeout(() => {
|
||||
this.visible = true;
|
||||
this.setData({
|
||||
visible: true
|
||||
})
|
||||
this.data.timer = setTimeout(() => {
|
||||
this.setData({
|
||||
visible: false
|
||||
})
|
||||
clearTimeout(this.data.timer);
|
||||
this.data.timer = null;
|
||||
}, duration);
|
||||
}, 50);
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
||||
10
微信小程序源码/iot-home/components/firstui/fui-toast/fui-toast.wxml
Normal file
10
微信小程序源码/iot-home/components/firstui/fui-toast/fui-toast.wxml
Normal file
@@ -0,0 +1,10 @@
|
||||
<view class="fui-toast__wrap {{visible?'fui-toast__show':''}}">
|
||||
<view class="fui-toast__inner" style="padding:{{padding}};background:{{background}};z-index:{{zIndex}}">
|
||||
<slot></slot>
|
||||
<view class="fui-toast__icon-box" wx:if="{{src}}" style="width:{{width}}rpx;height:{{width}}rpx">
|
||||
<image class="fui-toast__icon" src="{{src}}" style="width:{{width}}rpx;height:{{width}}rpx">
|
||||
</image>
|
||||
</view>
|
||||
<text class="fui-toast__text" style="font-size:{{size}}rpx;color:{{color}}" wx:if="{{text}}">{{text}}</text>
|
||||
</view>
|
||||
</view>
|
||||
43
微信小程序源码/iot-home/components/firstui/fui-toast/fui-toast.wxss
Normal file
43
微信小程序源码/iot-home/components/firstui/fui-toast/fui-toast.wxss
Normal file
@@ -0,0 +1,43 @@
|
||||
.fui-toast__wrap {
|
||||
position: fixed;
|
||||
left: 15%;
|
||||
right: 15%;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
z-index: 1002;
|
||||
display: flex;
|
||||
visibility: hidden;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition-property: opacity, visibility;
|
||||
transition-timing-function: ease-in-out;
|
||||
transition-duration: 0.3s;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.fui-toast__inner {
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.fui-toast__show {
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
}
|
||||
.fui-toast__icon-box {
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.fui-toast__icon {
|
||||
display: block;
|
||||
}
|
||||
.fui-toast__text {
|
||||
font-weight: 400;
|
||||
text-align: center;
|
||||
word-break: break-all;
|
||||
}
|
||||
Reference in New Issue
Block a user