@@ -42,59 +42,90 @@ const disabled = ref<boolean>(false)
4242```
4343
4444``` scss
45- :deep(.custom-button ) {
46- min-width : auto !important ;
47- box-sizing : border-box ;
48- width : 32px !important ;
49- height : 32px !important ;
50- border-radius : 16px !important ;
51- margin : 8 rpx;
52- }
53-
54- :deep(.custom-radio ) {
55- height : 32px !important ;
56- line-height : 32px !important ;
57- }
45+ :deep(.custom-button ) {
46+ min-width : auto !important ;
47+ box-sizing : border-box ;
48+ width : 32px !important ;
49+ height : 32px !important ;
50+ border-radius : 16px !important ;
51+ margin : 8 rpx;
52+ }
53+
54+ :deep(.custom-radio ) {
55+ height : 32px !important ;
56+ line-height : 32px !important ;
57+ }
5858```
5959
6060## 动作菜单展开/收起
6161
6262通过` v-model:active ` 控制动作按钮菜单的展开/收起
6363
6464``` html
65- <wd-fab v-model:active =" active" >
65+ <wd-fab v-model:active =" active" ></ wd-fab >
6666```
6767
6868``` ts
6969const active = ref <boolean >(false )
70-
7170```
7271
7372## 可拖动按钮
7473
7574``` html
76- <wd-fab :draggable =" true" >
75+ <wd-fab :draggable =" true" ></ wd-fab >
7776```
7877
7978::: warning
8079开启拖动后` direction ` 属性将失效,会根据拖动后的位置自动计算弹出方向。拖动完成后按钮将会自动吸边。
8180:::
8281
82+ ## 自定义触发器
83+
84+ 通过` trigger ` 插槽自定义触发器,` expandable ` 控制点击触发器是否展开/收起动作按钮菜单。
85+
86+
87+ ``` html
88+ <wd-fab position =" left-bottom" :expandable =" false" >
89+ <template #trigger >
90+ <wd-button @click =" handleClick" icon =" share" type =" error" >分享给朋友</wd-button >
91+ </template >
92+ </wd-fab >
93+ ```
94+ ``` ts
95+ const handleClick = () => {
96+ console .log (' 点击了' )
97+ }
98+
99+ ```
100+
83101## Attributes
84102
85- | 参数 | 说明 | 类型 | 可选值 | 默认值 | 最低版本 |
86- | -------------- | ---------------------------------- | ------------ | ----------------------------------------------------------------------------------------- | ---------------------------------------------- | ---------------- |
87- | v-model: active | 是否激活 | boolean | - | false | 0.1.57 |
88- | type | 类型 | FabType | 'primary' | ; 'success' | ; 'info' | ; 'warning' | ; 'error' | ; 'default' | 'primary' | 0.1.57 |
89- | position | 悬浮按钮位置 | FabPosition | 'left-top' | ; 'right-top' | ; 'left-bottom' | ; 'right-bottom' | 'right-bottom' | 0.1.57 |
90- | draggable | 按钮能否拖动 | boolean | | false | 1.2.19 |
91- | direction | 悬浮按钮菜单弹出方向 | FabDirection | 'top' | ; 'right' | ; 'bottom' | ; 'left' | 'top' | 0.1.57 |
92- | disabled | 是否禁用 | boolean | - | false | 0.1.57 |
93- | inactiveIcon | 悬浮按钮未展开时的图标 | string | - | 'add' | 0.1.57 |
94- | activeIcon | 悬浮按钮展开时的图标 | string | - | 'close' | 0.1.57 |
95- | zIndex | 自定义悬浮按钮层级 | number | - | 99 | 0.1.57 |
96- | gap | 自定义悬浮按钮与可视区域边缘的间距 | FabGap | - | \{ top: 16, left: 16, right: 16, bottom: 16 \} | 1.2.26 |
97- | customStyle | 自定义样式 | string | - | '' | 0.1.57 |
103+ | 参数 | 说明 | 类型 | 可选值 | 默认值 | 最低版本 |
104+ | -------------- | ----------------------------------------------------- | ------------ | ----------------------------------------------------------------------------------------- | ---------------------------------------------- | ---------------- |
105+ | v-model: active | 是否激活 | boolean | - | false | 0.1.57 |
106+ | type | 类型 | FabType | 'primary' | ; 'success' | ; 'info' | ; 'warning' | ; 'error' | ; 'default' | 'primary' | 0.1.57 |
107+ | position | 悬浮按钮位置 | FabPosition | 'left-top' | ; 'right-top' | ; 'left-bottom' | ; 'right-bottom' | 'right-bottom' | 0.1.57 |
108+ | draggable | 按钮能否拖动 | boolean | | false | 1.2.19 |
109+ | direction | 悬浮按钮菜单弹出方向 | FabDirection | 'top' | ; 'right' | ; 'bottom' | ; 'left' | 'top' | 0.1.57 |
110+ | disabled | 是否禁用 | boolean | - | false | 0.1.57 |
111+ | inactiveIcon | 悬浮按钮未展开时的图标 | string | - | 'add' | 0.1.57 |
112+ | activeIcon | 悬浮按钮展开时的图标 | string | - | 'close' | 0.1.57 |
113+ | zIndex | 自定义悬浮按钮层级 | number | - | 99 | 0.1.57 |
114+ | gap | 自定义悬浮按钮与可视区域边缘的间距 | FabGap | - | \{ top: 16, left: 16, right: 16, bottom: 16 \} | 1.2.26 |
115+ | customStyle | 自定义样式 | string | - | '' | 0.1.57 |
116+ | expandable | 用于控制点击时是否展开菜单,设置为 false 时触发 click | boolean | - | true | $LOWEST_VERSION$ |
117+
118+ ## Events
119+
120+ | 事件名称 | 说明 | 参数 | 最低版本 |
121+ | -------- | -------------------------------------------- | ---- | ---------------- |
122+ | click | expandable 设置为 false 时,点击悬浮按钮触发 | — | $LOWEST_VERSION$ |
123+
124+ ## Slot
125+
126+ | name | 说明 | 最低版本 |
127+ | ------- | -------------------------------------------------------------- | ---------------- |
128+ | trigger | 触发器插槽,用于自定义点击按钮,使用此插槽时组件不会抛出 click | $LOWEST_VERSION$ |
98129
99130## 外部样式类
100131
0 commit comments