Skip to content

Commit fcf8104

Browse files
author
davidysxue
committed
fix: toptips bug, add demo
1 parent ea80a3e commit fcf8104

File tree

7 files changed

+58
-1
lines changed

7 files changed

+58
-1
lines changed

src/toptips/toptips.less

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.weui-toptips_show.weui-toptips {
2+
display: block;
3+
}
4+
.weui-toptips_show {
5+
-webkit-transform: translateZ(0) translateY(0);
6+
transform: translateZ(0) translateY(0);
7+
opacity: 1;
8+
}
9+
.weui-toptips_success {
10+
background-color: var(--weui-BRAND);
11+
}
12+
.weui-toptips_error {
13+
background-color: var(--weui-RED);
14+
}
15+
.weui-toptips_info {
16+
background-color: var(--weui-BLUE);
17+
}

tools/demo/app.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"example/msg/msg_fail",
3333
"example/picker/picker",
3434
"example/toast/toast",
35+
"example/toptips/toptips",
3536

3637
"example/navbar/navbar",
3738
"example/navigation/navigation",

tools/demo/example/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ CustomPage({
3131
id: 'feedback',
3232
name: '操作反馈',
3333
open: false,
34-
pages: ['dialog', 'msg', 'half-screen-dialog', 'actionsheet']
34+
pages: ['dialog', 'msg', 'half-screen-dialog', 'actionsheet', 'toptips']
3535
},
3636
{
3737
id: 'nav',

tools/demo/example/toptips/toptips.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import CustomPage from '../../base/CustomPage'
2+
3+
CustomPage({
4+
data: {
5+
show: false
6+
},
7+
showToptips() {
8+
this.setData({
9+
show: true
10+
})
11+
}
12+
})
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"usingComponents": {
3+
"mp-toptips": "../../components/toptips/toptips"
4+
}
5+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<view class="page" data-weui-theme="{{theme}}">
2+
<view class="page__hd">
3+
<view class="page__title">Toptips</view>
4+
</view>
5+
<view class="page__bd">
6+
<button type="primary" disabled="{{disabled}}" bindtap="showToptips">显示Toptips</button>
7+
8+
<mp-toptips ext-class="top100" msg="距离顶部100px" type="error" show="{{show}}"></mp-toptips>
9+
<mp-toptips ext-class="top200" msg="距离顶部200px" type="info" show="{{show}}"></mp-toptips>
10+
<mp-toptips ext-class="top300" msg="距离顶部300px" type="success" show="{{show}}"></mp-toptips>
11+
</view>
12+
</view>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@import '../common.wxss';
2+
.weui-toptips.top100 {
3+
top: 100px;
4+
}
5+
.weui-toptips.top200 {
6+
top: 200px;
7+
}
8+
.weui-toptips.top300 {
9+
top: 300px;
10+
}

0 commit comments

Comments
 (0)