Skip to content

Commit 12d8e41

Browse files
committed
update(uni-ui): add onlyPlusButton option
1 parent 9ba24b4 commit 12d8e41

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

‎components/uni-fab/uni-fab.vue‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<view>
3-
<view v-if="leftBottom||rightBottom||leftTop||rightTop" :class="{
3+
<view v-if="!onlyPlusButton && (leftBottom||rightBottom||leftTop||rightTop)" :class="{
44
'uni-fab--leftBottom': leftBottom,
55
'uni-fab--rightBottom': rightBottom,
66
'uni-fab--leftTop': leftTop,
@@ -56,6 +56,7 @@
5656
* @value horizontal 水平显示
5757
* @value vertical 垂直显示
5858
* @property {Array} content 展开菜单内容配置项
59+
* @property {Boolean} onlyPlusButton 是否只显示加号按钮
5960
* @event {Function} trigger 展开菜单点击事件,返回点击信息
6061
*/
6162
export default {
@@ -88,6 +89,10 @@
8889
show: {
8990
type: Boolean,
9091
default: false
92+
},
93+
onlyPlusButton: {
94+
type: Boolean,
95+
default: false
9196
}
9297
},
9398
data() {
@@ -162,6 +167,10 @@
162167
},
163168
methods: {
164169
_onClick() {
170+
this.$emit('plusClick')
171+
if (this.onlyPlusButton) {
172+
return
173+
}
165174
this.isShow = !this.isShow
166175
},
167176
open() {

‎pages/extUI/fab/fab.nvue‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<view class="word-btn" hover-class="word-btn--hover" :hover-start-time="20" :hover-stay-time="70" @click="switchBtn('left', 'top')"><text class="word-btn-white">左上角显示</text></view>
88
<view class="word-btn" hover-class="word-btn--hover" :hover-start-time="20" :hover-stay-time="70" @click="switchBtn('right', 'top')"><text class="word-btn-white">右上角显示</text></view>
99
</view>
10-
<uni-fab ref="fab" :pattern="pattern" :content="content" :horizontal="horizontal" :vertical="vertical" :direction="direction" @trigger="trigger" />
10+
<uni-fab ref="fab" :pattern="pattern" :content="content" :horizontal="horizontal" :vertical="vertical" :direction="direction" @trigger="trigger" @plusClick="plusClick" />
1111
</view>
1212
</template>
1313

@@ -74,6 +74,12 @@
7474
}
7575
})
7676
},
77+
plusClick() {
78+
uni.showToast({
79+
title: '点击了加号按钮',
80+
icon: 'none'
81+
})
82+
},
7783
switchBtn(hor, ver) {
7884
if (hor === 0) {
7985
this.direction = this.direction === 'horizontal' ? 'vertical' : 'horizontal'

0 commit comments

Comments
 (0)