papayaui 0.2.20 → 0.2.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,9 @@
18
18
  @closed="emit('closed')"
19
19
  >
20
20
  <view :class="ns.b('content')">
21
+ <slot name="before" />
21
22
  <Search v-if="showSearch" v-model="searchText" v-bind="searchProps" :class="ns.b('search')" />
23
+ <slot name="after-search" />
22
24
  <view v-if="show" :class="ns.b('tab')">
23
25
  <Tabs v-model="tabActive" :tabs="tabList" label-key="name" scrollable shrink />
24
26
  </view>
@@ -250,7 +252,18 @@ const onSelectSearch = (item: SearchNode) => {
250
252
  }
251
253
 
252
254
  const onSelectFinish = (item: TreeNode<CascaderOption>) => {
253
- if (setSelect(item) && !localState.value.hasConfirm) {
255
+ // 多选或者开启确认按钮时,只设置选中数据
256
+ if (localState.value.hasConfirm) {
257
+ setSelect(item)
258
+ return
259
+ }
260
+ // 单选时,选中已选中的节点时直接关闭弹窗
261
+ if (isSelected(item[_fieldNames.value.value])) {
262
+ onClose()
263
+ return
264
+ }
265
+ // 单选时,节点选择成功时修改数据并关闭弹窗
266
+ if (setSelect(item)) {
254
267
  onConfirm()
255
268
  }
256
269
  }
@@ -228,7 +228,19 @@ const onCreate = async () => {
228
228
 
229
229
  const onSelect = async (value: OptionValue, item: Option) => {
230
230
  emit('select', value, item)
231
- if (_onSelect(value) && !showView.value.confirm) {
231
+
232
+ // 多选或者开启确认按钮时,只设置选中数据
233
+ if (showView.value.confirm) {
234
+ _onSelect(value)
235
+ return
236
+ }
237
+ // 单选时,选中已选中的节点时直接关闭弹窗
238
+ if (isSelected(value)) {
239
+ onClose()
240
+ return
241
+ }
242
+ // 单选时,节点选择成功时修改数据并关闭弹窗
243
+ if (_onSelect(value)) {
232
244
  onOk()
233
245
  }
234
246
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "papayaui",
3
- "version": "0.2.20",
3
+ "version": "0.2.22",
4
4
  "description": "适用于uniapp的ui扩展库",
5
5
  "packageManager": "pnpm@8.6.0",
6
6
  "dependencies": {