@ebfe/vant-kit 0.0.3 → 0.0.5

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.
Files changed (66) hide show
  1. package/dist/ColoringAvatar/ColoringAvatar.vue.d.ts +16 -0
  2. package/dist/CopyTxtTrigger/CopyTxtTrigger.vue.d.ts +16 -0
  3. package/dist/DatePicker/DatePicker.vue.d.ts +35 -0
  4. package/dist/DateRangePicker/DateRangePicker.vue.d.ts +40 -0
  5. package/dist/FieldDatePicker/FieldDatePicker.vue.d.ts +162 -0
  6. package/dist/FieldDateRangePicker/FieldDateRangePicker.vue.d.ts +166 -0
  7. package/dist/FieldMaskTxt/FieldMaskTxt.vue.d.ts +25 -0
  8. package/dist/FieldMultiPicker/FieldMultiPicker.vue.d.ts +126 -0
  9. package/dist/FieldSinglePicker/FieldSinglePicker.vue.d.ts +32 -0
  10. package/dist/FieldSwitchBtn/FieldSwitchBtn.vue.d.ts +19 -0
  11. package/dist/MaskTxt/MaskTxt.vue.d.ts +23 -0
  12. package/dist/MultiPicker/MultiPicker.vue.d.ts +52 -0
  13. package/dist/SinglePicker/SinglePicker.vue.d.ts +37 -0
  14. package/dist/common/constants.d.ts +2 -0
  15. package/dist/common/hooks/useMaskedFieldLogic.d.ts +32 -0
  16. package/dist/common/index.d.ts +1 -0
  17. package/dist/index.d.ts +22 -0
  18. package/dist/vant-kit.css +1 -0
  19. package/dist/vant-kit.es.js +11837 -0
  20. package/dist/vant-kit.umd.js +40 -0
  21. package/package.json +32 -32
  22. package/es/field-multi-picker/README.md +0 -97
  23. package/es/field-multi-picker/index-sfc.less +0 -3
  24. package/es/field-multi-picker/index.ts +0 -139
  25. package/es/field-multi-picker/style/index.js +0 -0
  26. package/es/field-multi-picker/style/less.js +0 -0
  27. package/es/field-single-picker/README.md +0 -94
  28. package/es/field-single-picker/index-sfc.less +0 -3
  29. package/es/field-single-picker/index.ts +0 -158
  30. package/es/field-single-picker/style/index.js +0 -0
  31. package/es/field-single-picker/style/less.js +0 -0
  32. package/es/index.js +0 -25
  33. package/es/multi-picker/README.md +0 -183
  34. package/es/multi-picker/index-sfc.less +0 -20
  35. package/es/multi-picker/index.ts +0 -399
  36. package/es/multi-picker/style/index.js +0 -0
  37. package/es/multi-picker/style/less.js +0 -0
  38. package/es/single-picker/README.md +0 -239
  39. package/es/single-picker/index-sfc.less +0 -4
  40. package/es/single-picker/index.ts +0 -253
  41. package/es/single-picker/style/index.js +0 -0
  42. package/es/single-picker/style/less.js +0 -0
  43. package/es/vue-sfc-shim.d.ts +0 -5
  44. package/lib/field-multi-picker/README.md +0 -97
  45. package/lib/field-multi-picker/index-sfc.less +0 -3
  46. package/lib/field-multi-picker/index.ts +0 -139
  47. package/lib/field-multi-picker/style/index.js +0 -0
  48. package/lib/field-multi-picker/style/less.js +0 -0
  49. package/lib/field-single-picker/README.md +0 -94
  50. package/lib/field-single-picker/index-sfc.less +0 -3
  51. package/lib/field-single-picker/index.ts +0 -158
  52. package/lib/field-single-picker/style/index.js +0 -0
  53. package/lib/field-single-picker/style/less.js +0 -0
  54. package/lib/index.js +0 -25
  55. package/lib/index.less +0 -0
  56. package/lib/multi-picker/README.md +0 -183
  57. package/lib/multi-picker/index-sfc.less +0 -20
  58. package/lib/multi-picker/index.ts +0 -399
  59. package/lib/multi-picker/style/index.js +0 -0
  60. package/lib/multi-picker/style/less.js +0 -0
  61. package/lib/single-picker/README.md +0 -239
  62. package/lib/single-picker/index-sfc.less +0 -4
  63. package/lib/single-picker/index.ts +0 -253
  64. package/lib/single-picker/style/index.js +0 -0
  65. package/lib/single-picker/style/less.js +0 -0
  66. package/lib/vue-sfc-shim.d.ts +0 -5
@@ -1,399 +0,0 @@
1
- // @ts-nocheck
2
- import './index-sfc.css';
3
- import { defineComponent as _defineComponent } from 'vue';
4
- import { computed, watch } from 'vue';
5
- import { debounce } from 'lodash';
6
- import {
7
- Popup as VanPopup,
8
- CheckboxGroup as VanCheckboxGroup,
9
- CellGroup as VanCellGroup,
10
- Cell as VanCell,
11
- Checkbox as VanCheckbox,
12
- Search as VanSearch,
13
- } from 'vant';
14
- import { useWrapperRef } from '@ebfe/vhooks';
15
-
16
- import { ref } from 'vue';
17
-
18
- const __default__ = {
19
- name: 'MultiPicker',
20
- };
21
-
22
- type IdMapData = {
23
- [key in string]: any;
24
- };
25
-
26
- type TFieldNames = {
27
- label: string;
28
- value: string;
29
- };
30
-
31
- export type TMultiPickerProps = {
32
- // ids
33
- modelValue: any[];
34
- // 选项列表
35
- options: any[];
36
- // 字段别名
37
- fieldNames?: TFieldNames;
38
- // title
39
- title?: string;
40
- // 提示信息
41
- tipTxt?: string;
42
- // 搜索功能
43
- showSearch?: boolean;
44
- searchDelay?: number;
45
- };
46
-
47
- export type TConfirmEventPayload = { values: any[]; options: any[] };
48
-
49
- const __vue_sfc__ = /*@__PURE__*/ _defineComponent({
50
- ...__default__,
51
- props: {
52
- modelValue: { type: Array, required: true },
53
- options: { type: Array, required: true },
54
- fieldNames: { type: Object, required: false, default: undefined },
55
- title: { type: String, required: false, default: undefined },
56
- tipTxt: { type: String, required: false, default: undefined },
57
- showSearch: { type: Boolean, required: false, default: false },
58
- searchDelay: { type: Number, required: false, default: 300 },
59
- },
60
- emits: ['search', 'toggleCheckbox', 'confirm', 'update:modelValue'],
61
- setup(__props: any, { expose: __expose, emit: __emit }) {
62
- const Props = __props;
63
-
64
- const computedFieldNames = computed(() =>
65
- Object.assign({ label: 'label', value: 'value' }, Props?.fieldNames ?? {})
66
- );
67
-
68
- const Emitter = __emit;
69
-
70
- const [popupShow, setPopupShow] = useWrapperRef<boolean>(false);
71
- // 用于展示的选项值
72
- const [showValue, setShowValue] = useWrapperRef<string>('');
73
- // checkbox实时绑定的选项值
74
- const [checkboxModelValue, setCheckboxModelValue] = useWrapperRef<any[]>([]);
75
- watch(
76
- Props.modelValue,
77
- (newValue) => {
78
- setCheckboxModelValue(newValue);
79
- },
80
- { immediate: true }
81
- );
82
-
83
- /**
84
- * value 映射的选项信息
85
- */
86
- const genIdMapOptionData = (options: any[]): IdMapData => {
87
- const res = {} as IdMapData;
88
- options?.forEach?.((item) => {
89
- res[item[computedFieldNames.value.value]] = item;
90
- });
91
- // console.log('genIdMapOptionData', res);
92
- return res;
93
- };
94
-
95
- const [optionsIdMapData, _setOptionsIdMapData] = useWrapperRef<IdMapData>(genIdMapOptionData(Props.options));
96
- const patchIdMapOptionData = (newOptions) => {
97
- newOptions?.forEach?.((item) => {
98
- optionsIdMapData[item[computedFieldNames.value.value]] = item;
99
- });
100
- };
101
- watch(() => Props.options, patchIdMapOptionData, { immediate: true });
102
-
103
- const [selectedOptions, setSelectedOptions] = useWrapperRef<any[]>([]);
104
- const handleUpdateModelValue = (values: any[]) => {
105
- Emitter('update:modelValue', values);
106
- setSelectedOptions(values?.map?.((v) => optionsIdMapData.value?.[v]));
107
- };
108
-
109
- /**
110
- * 根据 modelValue 回显 showModelValue
111
- */
112
- const updateShowModelValueByModelValue = () => {
113
- setShowValue(
114
- Props.modelValue
115
- ?.map?.((item) => optionsIdMapData.value?.[item]?.[computedFieldNames.value?.label])
116
- ?.join?.('、')
117
- );
118
- };
119
- watch(
120
- [optionsIdMapData, () => Props.modelValue],
121
- () => {
122
- updateShowModelValueByModelValue();
123
- },
124
- { immediate: true }
125
- );
126
-
127
- /**
128
- * 打开 popup
129
- */
130
- const triggerPopupShow = () => {
131
- setPopupShow(true);
132
- };
133
-
134
- /**
135
- * 点击取消
136
- */
137
- const handleCancel = () => {
138
- setPopupShow(false);
139
- // checkbox选中状态回滚
140
- setCheckboxModelValue(Props.modelValue);
141
- };
142
-
143
- /**
144
- * checkbox
145
- */
146
- const checkboxRefs = ref([]);
147
- const toggle = (item: any, index: number) => {
148
- if (item?.disabled) return;
149
- (checkboxRefs.value?.[index] as any)?.toggle?.();
150
- Emitter('toggleCheckbox', checkboxModelValue.value);
151
- };
152
-
153
- /**
154
- * 确认选择
155
- */
156
- const onConfirm = () => {
157
- const newValue = checkboxModelValue.value;
158
- handleUpdateModelValue(newValue);
159
- Emitter('confirm', { values: newValue, options: selectedOptions.value });
160
- setPopupShow(false);
161
- };
162
-
163
- /**
164
- * 搜索功能
165
- */
166
- const [keywords, _] = useWrapperRef<string | undefined>(undefined);
167
-
168
- const onSearch = debounce((keywords: string) => {
169
- Emitter('search', keywords);
170
- }, Props.searchDelay);
171
-
172
- __expose({
173
- getOptionsIdMapData() {
174
- return optionsIdMapData.value;
175
- },
176
- });
177
-
178
- const __returned__ = {
179
- Props,
180
- computedFieldNames,
181
- Emitter,
182
- popupShow,
183
- setPopupShow,
184
- showValue,
185
- setShowValue,
186
- checkboxModelValue,
187
- setCheckboxModelValue,
188
- genIdMapOptionData,
189
- optionsIdMapData,
190
- _setOptionsIdMapData,
191
- patchIdMapOptionData,
192
- selectedOptions,
193
- setSelectedOptions,
194
- handleUpdateModelValue,
195
- updateShowModelValueByModelValue,
196
- triggerPopupShow,
197
- handleCancel,
198
- checkboxRefs,
199
- toggle,
200
- onConfirm,
201
- keywords,
202
- _,
203
- onSearch,
204
- get VanPopup() {
205
- return VanPopup;
206
- },
207
- get VanCheckboxGroup() {
208
- return VanCheckboxGroup;
209
- },
210
- get VanCellGroup() {
211
- return VanCellGroup;
212
- },
213
- get VanCell() {
214
- return VanCell;
215
- },
216
- get VanCheckbox() {
217
- return VanCheckbox;
218
- },
219
- get VanSearch() {
220
- return VanSearch;
221
- },
222
- };
223
- Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true });
224
- return __returned__;
225
- },
226
- });
227
- import {
228
- renderSlot as _renderSlot,
229
- normalizeClass as _normalizeClass,
230
- createElementVNode as _createElementVNode,
231
- createVNode as _createVNode,
232
- openBlock as _openBlock,
233
- createElementBlock as _createElementBlock,
234
- createCommentVNode as _createCommentVNode,
235
- toDisplayString as _toDisplayString,
236
- renderList as _renderList,
237
- Fragment as _Fragment,
238
- withModifiers as _withModifiers,
239
- withCtx as _withCtx,
240
- createBlock as _createBlock,
241
- } from 'vue';
242
-
243
- const _hoisted_1 = { class: 'multi-picker' };
244
- const _hoisted_2 = { class: 'multi-picker-header van-picker__toolbar' };
245
- const _hoisted_3 = { key: 0 };
246
- const _hoisted_4 = { class: 'van-picker__title van-ellipsis' };
247
- const _hoisted_5 = { class: 'multi-picker-main' };
248
- const _hoisted_6 = {
249
- key: 0,
250
- class: 'multi-picker-tip',
251
- };
252
-
253
- function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
254
- return (
255
- _openBlock(),
256
- _createElementBlock('div', _hoisted_1, [
257
- _renderSlot(_ctx.$slots, 'trigger', {
258
- triggerPopupShow: $setup.triggerPopupShow,
259
- showValue: $setup.showValue,
260
- selectedOptions: $setup.selectedOptions,
261
- }),
262
- _createVNode(
263
- $setup['VanPopup'],
264
- {
265
- show: $setup.popupShow,
266
- 'onUpdate:show': _cache[2] || (_cache[2] = ($event) => ($setup.popupShow = $event)),
267
- onClickOverlay: $setup.handleCancel,
268
- position: 'bottom',
269
- round: '',
270
- },
271
- {
272
- default: _withCtx(() => [
273
- _createVNode(
274
- $setup['VanCheckboxGroup'],
275
- {
276
- modelValue: $setup.checkboxModelValue,
277
- 'onUpdate:modelValue': _cache[1] || (_cache[1] = ($event) => ($setup.checkboxModelValue = $event)),
278
- },
279
- {
280
- default: _withCtx(() => [
281
- _createElementVNode('div', _hoisted_2, [
282
- _createElementVNode(
283
- 'button',
284
- {
285
- class: _normalizeClass(['van-picker__cancel', 'van-haptics-feedback']),
286
- onClick: $setup.handleCancel,
287
- },
288
- '取消'
289
- ),
290
- $props.showSearch
291
- ? (_openBlock(),
292
- _createElementBlock('div', _hoisted_3, [
293
- _createVNode(
294
- $setup['VanSearch'],
295
- {
296
- shape: 'round',
297
- placeholder: '请输入搜索关键词',
298
- modelValue: $setup.keywords,
299
- 'onUpdate:modelValue': [
300
- _cache[0] || (_cache[0] = ($event) => ($setup.keywords = $event)),
301
- $setup.onSearch,
302
- ],
303
- },
304
- null,
305
- 8 /* PROPS */,
306
- ['modelValue', 'onUpdate:modelValue']
307
- ),
308
- ]))
309
- : _renderSlot(_ctx.$slots, 'title', { key: 1 }, () => [
310
- _createElementVNode('div', _hoisted_4, _toDisplayString($props.title), 1 /* TEXT */),
311
- ]),
312
- _createElementVNode(
313
- 'button',
314
- {
315
- class: _normalizeClass(['van-picker__confirm', 'van-haptics-feedback']),
316
- onClick: $setup.onConfirm,
317
- },
318
- '确定'
319
- ),
320
- ]),
321
- _createElementVNode('div', _hoisted_5, [
322
- $props.tipTxt
323
- ? (_openBlock(),
324
- _createElementBlock('div', _hoisted_6, _toDisplayString($props.tipTxt), 1 /* TEXT */))
325
- : _createCommentVNode('v-if', true),
326
- _createVNode(
327
- $setup['VanCellGroup'],
328
- {
329
- class: 'multi-picker-cell-group',
330
- inset: '',
331
- },
332
- {
333
- default: _withCtx(() => [
334
- (_openBlock(true),
335
- _createElementBlock(
336
- _Fragment,
337
- null,
338
- _renderList($props.options, (item, index) => {
339
- return (
340
- _openBlock(),
341
- _createBlock(
342
- $setup['VanCell'],
343
- {
344
- clickable: '',
345
- key: item?.[$setup.computedFieldNames.value],
346
- title: item?.[$setup.computedFieldNames.label],
347
- onClick: ($event) => $setup.toggle(item, index),
348
- },
349
- {
350
- 'right-icon': _withCtx(() => [
351
- _createVNode(
352
- $setup['VanCheckbox'],
353
- {
354
- name: item?.[$setup.computedFieldNames.value],
355
- disabled: item?.disabled,
356
- ref_for: true,
357
- ref: (el) => {
358
- ($setup.checkboxRefs as any)[index] = el;
359
- },
360
- onClick: _withModifiers(($event) => $setup.toggle(item, index), ['stop']),
361
- },
362
- null,
363
- 8 /* PROPS */,
364
- ['name', 'disabled', 'onClick']
365
- ),
366
- ]),
367
- _: 2 /* DYNAMIC */,
368
- },
369
- 1032 /* PROPS, DYNAMIC_SLOTS */,
370
- ['title', 'onClick']
371
- )
372
- );
373
- }),
374
- 128 /* KEYED_FRAGMENT */
375
- )),
376
- ]),
377
- _: 1 /* STABLE */,
378
- }
379
- ),
380
- ]),
381
- ]),
382
- _: 3 /* FORWARDED */,
383
- },
384
- 8 /* PROPS */,
385
- ['modelValue']
386
- ),
387
- ]),
388
- _: 3 /* FORWARDED */,
389
- },
390
- 8 /* PROPS */,
391
- ['show']
392
- ),
393
- ])
394
- );
395
- }
396
- __vue_sfc__.render = __vue_render__;
397
-
398
- __vue_sfc__.__scopeId = 'data-v-d088a892';
399
- export default __vue_sfc__;
File without changes
File without changes
@@ -1,239 +0,0 @@
1
- # SinglePicker
2
-
3
- ### 介绍
4
-
5
- 主要基于 vant 的 popup、picker 组件进行二次封装,方便处理单项选择的需求场景。
6
-
7
- - 支持传入所有 [picker props](https://vant-ui.github.io/vant/#/zh-CN/picker#props)
8
- - 支持暴露所有 [picker slots](https://vant-ui.github.io/vant/#/zh-CN/picker#slots)
9
-
10
- **主要功能描述**
11
-
12
- - 支持自定义触发器
13
- - 支持开启搜索功能
14
- - 禁用选项逻辑增强
15
-
16
- **对开发者的解脱**
17
-
18
- - 符合 ui 设计
19
- - 打开收起逻辑的编写
20
- - 对所选项的 `真实值`、`展示值` 的处理
21
-
22
- ## 代码演示
23
-
24
- ### 基础用法
25
-
26
- ```html
27
- <template>
28
- <SinglePicker
29
- v-model="pickerValue"
30
- :picker-props="{
31
- title: '基础用法',
32
- columns: columns,
33
- columnsFieldNames: columnsFieldNames,
34
- }"
35
- >
36
- <template #trigger="{ triggerPopupShow, showValue }">
37
- <div class="trigger-box">
38
- <van-button type="primary" @click="triggerPopupShow"> 点击打开选择器🤪 </van-button>
39
- <p>show value: {{ showValue }}</p>
40
- <p>modelValue: {{ pickerValue }}</p>
41
- </div>
42
- </template>
43
- </SinglePicker>
44
- </template>
45
-
46
- <script setup lang="ts">
47
- import { useWrapperRef } from '@ebfe/vhooks';
48
- import SinglePicker from '../index.vue';
49
- import { Button as VanButton } from 'vant';
50
-
51
- const columns = [
52
- { name: '选项1', value: '1' },
53
- { name: '选项2', value: '2' },
54
- ];
55
- const columnsFieldNames = {
56
- text: 'name',
57
- value: 'value',
58
- };
59
- const [pickerValue, _setPickerValue] = useWrapperRef<string | undefined>(undefined);
60
- </script>
61
-
62
- <style scoped lang="less">
63
- .trigger-box {
64
- display: flex;
65
- flex-direction: column;
66
- justify-content: center;
67
- align-items: center;
68
- }
69
- </style>
70
- ```
71
-
72
- ### 开启搜索功能
73
-
74
- - 传入 show-earch 展示搜索框
75
- - 侦听 search 事件处理搜索逻辑
76
-
77
- > 💫 对交互细节的优化:如果在输入关键字进行搜索后,新的数据源为空,此时点击确定,更新的值依旧为最近一次选中的选项。
78
-
79
- ```html
80
- <template>
81
- <SinglePicker
82
- v-model="pickerValue"
83
- :picker-props="{
84
- columns: columns,
85
- columnsFieldNames: columnsFieldNames,
86
- }"
87
- show-search
88
- @search="onSearch"
89
- >
90
- <template #trigger="{ triggerPopupShow, showValue }">
91
- <div class="trigger-box">
92
- <van-button type="primary" @click="triggerPopupShow"> 带搜索框🔍 </van-button>
93
- <p>show value: {{ showValue }}</p>
94
- <p>modelValue: {{ pickerValue }}</p>
95
- </div>
96
- </template>
97
-
98
- <template #title>Ashun</template>
99
- </SinglePicker>
100
- </template>
101
-
102
- <script setup lang="ts">
103
- import { useWrapperRef } from '@ebfe/vhooks';
104
- import SinglePicker from '../index.vue';
105
- import { Button as VanButton } from 'vant';
106
- import { checkStrIsEmpty } from '@ebfe/utils';
107
-
108
- const columnsDataSource = [
109
- { name: '选项1', value: '1' },
110
- { name: '选项2', value: '2' },
111
- ];
112
- const [columns, setColumns] = useWrapperRef(columnsDataSource);
113
- const columnsFieldNames = {
114
- text: 'name',
115
- value: 'value',
116
- };
117
- const [pickerValue, _setPickerValue] = useWrapperRef<string | undefined>(undefined);
118
-
119
- const onSearch = (keywords: string) => {
120
- if (checkStrIsEmpty(keywords)) {
121
- setColumns(columnsDataSource);
122
- } else {
123
- setColumns(
124
- columnsDataSource.filter((item) => item.name.toLocaleLowerCase().includes(keywords.toLocaleLowerCase()))
125
- );
126
- }
127
- };
128
- </script>
129
-
130
- <style scoped lang="less">
131
- .trigger-box {
132
- display: flex;
133
- flex-direction: column;
134
- justify-content: center;
135
- align-items: center;
136
- }
137
- </style>
138
- ```
139
-
140
- ### 禁用选项逻辑增强
141
-
142
- ```html
143
- <template>
144
- <SinglePicker
145
- v-model="pickerValue"
146
- :picker-props="{
147
- title,
148
- columns: columns,
149
- columnsFieldNames: columnsFieldNames,
150
- }"
151
- @confirm-disabled-option="
152
- ({}) =>
153
- showToast(
154
- '你可以自定义后续操作,回调函数参数类型 TConfirmDisabledOptionPayload',
155
- )
156
- "
157
- >
158
- <template #trigger="{ triggerPopupShow, showValue }">
159
- <div class="trigger-box">
160
- <span>
161
- <van-button @click="showPartialDisableOptions(triggerPopupShow)"> 部分选项禁用 </van-button>
162
- <van-button @click="showAllDisableOptions(triggerPopupShow)"> 全部选项禁用 </van-button>
163
- </span>
164
- <p>show value: {{ showValue }}</p>
165
- <p>modelValue: {{ pickerValue }}</p>
166
- </div>
167
- </template>
168
- </SinglePicker>
169
- </template>
170
-
171
- <script setup lang="ts">
172
- import { useWrapperRef } from '@ebfe/vhooks';
173
- import SinglePicker from '../index.vue';
174
- import { showToast, Button as VanButton } from 'vant';
175
-
176
- const partialDisableCols = [
177
- { name: '选项1', value: '1' },
178
- { name: '选项2(禁用)', value: '2', disabled: true },
179
- { name: '选项3', value: '3' },
180
- ];
181
- const allDisableCols = [
182
- { name: '选项1(禁用)', value: '1(禁用)', disabled: true },
183
- { name: '选项2(禁用)', value: '2(禁用)', disabled: true },
184
- { name: '选项3(禁用)', value: '3(禁用)', disabled: true },
185
- ];
186
- const [columns, setColumns] = useWrapperRef(partialDisableCols);
187
- const columnsFieldNames = {
188
- text: 'name',
189
- value: 'value',
190
- };
191
- const [pickerValue, _setPickerValue] = useWrapperRef<string | undefined>(undefined);
192
-
193
- const [title, setTitle] = useWrapperRef<string>('');
194
- const showPartialDisableOptions = (triggerPopupShow) => {
195
- setTitle('部分选项禁用');
196
- setColumns(partialDisableCols);
197
- triggerPopupShow();
198
- };
199
- const showAllDisableOptions = (triggerPopupShow) => {
200
- setTitle('全部选项禁用');
201
- setColumns(allDisableCols);
202
- triggerPopupShow();
203
- };
204
- </script>
205
-
206
- <style scoped lang="less">
207
- .trigger-box {
208
- display: flex;
209
- flex-direction: column;
210
- justify-content: center;
211
- align-items: center;
212
- }
213
- </style>
214
- ```
215
-
216
- ## API
217
-
218
- ### Props
219
-
220
- | 参数 | 说明 | 类型 | 默认值 |
221
- | ------------ | ------------------------------------------------------------------------------- | -------------------- | ------ |
222
- | v-model | 当前选中项对应的值 | string \| undefinerd | - |
223
- | picker-props | [vant Picker 组件的 props](https://vant-ui.github.io/vant/#/zh-CN/picker#props) | | |
224
- | show-search | 是否显示搜索框 | boolean | false |
225
- | search-delay | 搜索防抖时间(ms) | number | 300 |
226
-
227
- ### Events
228
-
229
- | 事件名 | 说明 | 回调参数 |
230
- | :-------------------- | :----------------------------- | :---------------------------------------------------------------------------- |
231
- | confirm | 点击 picker 确认后触发的事件 | option (选中项的全部数据) |
232
- | search | 在搜索框输入时,触发的搜索事件 | keywords |
233
- | confirmDisabledOption | 选中禁用项时,触发的事件 | type TConfirmDisabledOptionPayload = { option: any; closePopup: () => void; } |
234
-
235
- ### Slots
236
-
237
- | 名称 | 说明 | 参数 |
238
- | :------ | :----- | :----------------------------------------------------------------------------- |
239
- | trigger | 触发器 | `{ trigger-popup-show: () => void; show-value: string; selected-option: any }` |
@@ -1,4 +0,0 @@
1
- @import 'vant/lib/index.css';
2
- [data-v-03e3b57e] .van-search {
3
- width: 250px;
4
- }