x-next 1.12.0 → 1.14.0
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.
- package/AI_CODING.md +6 -5
- package/AI_USAGE/catalog.md +106 -105
- package/AI_USAGE/components/alert-api.md +48 -0
- package/AI_USAGE/components/alert.md +222 -3
- package/AI_USAGE/components/bar-chart-api.md +177 -0
- package/AI_USAGE/components/bar-chart.md +297 -3
- package/AI_USAGE/components/boxicons.md +147 -0
- package/AI_USAGE/components/button-api.md +144 -0
- package/AI_USAGE/components/button.md +447 -3
- package/AI_USAGE/components/charts.md +81 -0
- package/AI_USAGE/components/checkbox-api.md +145 -0
- package/AI_USAGE/components/checkbox.md +365 -3
- package/AI_USAGE/components/color-picker-api.md +52 -0
- package/AI_USAGE/components/color-picker.md +211 -3
- package/AI_USAGE/components/config-provider-api.md +38 -0
- package/AI_USAGE/components/config-provider.md +250 -3
- package/AI_USAGE/components/date-picker-api.md +1114 -0
- package/AI_USAGE/components/date-picker.md +378 -3
- package/AI_USAGE/components/dialog-api.md +142 -0
- package/AI_USAGE/components/dialog.md +284 -3
- package/AI_USAGE/components/draggable-api.md +146 -0
- package/AI_USAGE/components/draggable.md +259 -0
- package/AI_USAGE/components/drawer-api.md +78 -0
- package/AI_USAGE/components/drawer.md +227 -0
- package/AI_USAGE/components/dropdown-api.md +529 -0
- package/AI_USAGE/components/dropdown.md +392 -3
- package/AI_USAGE/components/empty-api.md +36 -0
- package/AI_USAGE/components/empty.md +227 -3
- package/AI_USAGE/components/finicon.md +88 -0
- package/AI_USAGE/components/form-api.md +524 -0
- package/AI_USAGE/components/form.md +454 -0
- package/AI_USAGE/components/grid-api.md +527 -0
- package/AI_USAGE/components/grid.md +224 -0
- package/AI_USAGE/components/heatmap-api.md +122 -0
- package/AI_USAGE/components/heatmap.md +220 -0
- package/AI_USAGE/components/icon-api.md +4707 -0
- package/AI_USAGE/components/icon.md +257 -0
- package/AI_USAGE/components/image-api.md +440 -0
- package/AI_USAGE/components/image.md +465 -0
- package/AI_USAGE/components/input-api.md +184 -0
- package/AI_USAGE/components/input-number-api.md +66 -0
- package/AI_USAGE/components/input-number.md +294 -0
- package/AI_USAGE/components/input-tag-api.md +114 -0
- package/AI_USAGE/components/input-tag.md +482 -0
- package/AI_USAGE/components/input.md +293 -3
- package/AI_USAGE/components/layout-api.md +147 -0
- package/AI_USAGE/components/layout.md +230 -0
- package/AI_USAGE/components/line-chart-api.md +197 -0
- package/AI_USAGE/components/line-chart.md +279 -3
- package/AI_USAGE/components/link-api.md +42 -0
- package/AI_USAGE/components/link.md +197 -0
- package/AI_USAGE/components/menu-api.md +516 -0
- package/AI_USAGE/components/menu.md +268 -0
- package/AI_USAGE/components/message-api.md +215 -0
- package/AI_USAGE/components/message-box-api.md +108 -0
- package/AI_USAGE/components/message-box.md +268 -3
- package/AI_USAGE/components/message.md +231 -3
- package/AI_USAGE/components/network-api.md +91 -0
- package/AI_USAGE/components/network.md +378 -0
- package/AI_USAGE/components/notification-api.md +236 -0
- package/AI_USAGE/components/notification.md +275 -3
- package/AI_USAGE/components/pagination-api.md +62 -0
- package/AI_USAGE/components/pagination.md +386 -5
- package/AI_USAGE/components/pie-chart-api.md +109 -0
- package/AI_USAGE/components/pie-chart.md +245 -3
- package/AI_USAGE/components/popconfirm-api.md +75 -0
- package/AI_USAGE/components/popconfirm.md +231 -3
- package/AI_USAGE/components/popover-api.md +75 -0
- package/AI_USAGE/components/popover.md +208 -3
- package/AI_USAGE/components/popup-api.md +75 -0
- package/AI_USAGE/components/popup.md +52 -0
- package/AI_USAGE/components/progress-api.md +44 -0
- package/AI_USAGE/components/progress.md +248 -3
- package/AI_USAGE/components/radio-api.md +165 -0
- package/AI_USAGE/components/radio.md +259 -3
- package/AI_USAGE/components/rate-api.md +54 -0
- package/AI_USAGE/components/rate.md +233 -3
- package/AI_USAGE/components/resize-box-api.md +56 -0
- package/AI_USAGE/components/resize-box.md +231 -0
- package/AI_USAGE/components/scrollbar-api.md +77 -0
- package/AI_USAGE/components/scrollbar.md +218 -0
- package/AI_USAGE/components/select-api.md +758 -0
- package/AI_USAGE/components/select.md +640 -3
- package/AI_USAGE/components/skeleton-api.md +85 -0
- package/AI_USAGE/components/skeleton.md +150 -0
- package/AI_USAGE/components/slider-api.md +51 -0
- package/AI_USAGE/components/slider.md +233 -3
- package/AI_USAGE/components/space-api.md +38 -0
- package/AI_USAGE/components/space.md +145 -0
- package/AI_USAGE/components/spin-api.md +43 -0
- package/AI_USAGE/components/spin.md +205 -0
- package/AI_USAGE/components/steps-api.md +111 -0
- package/AI_USAGE/components/steps.md +201 -3
- package/AI_USAGE/components/switch-api.md +58 -0
- package/AI_USAGE/components/switch.md +290 -3
- package/AI_USAGE/components/table-api.md +2919 -0
- package/AI_USAGE/components/table.md +1414 -0
- package/AI_USAGE/components/tabs-api.md +135 -0
- package/AI_USAGE/components/tabs.md +308 -3
- package/AI_USAGE/components/tag-api.md +124 -0
- package/AI_USAGE/components/tag.md +292 -0
- package/AI_USAGE/components/textarea-api.md +55 -0
- package/AI_USAGE/components/textarea.md +326 -3
- package/AI_USAGE/components/time-picker-api.md +137 -0
- package/AI_USAGE/components/time-picker.md +271 -3
- package/AI_USAGE/components/time-range-selector-api.md +44 -0
- package/AI_USAGE/components/time-range-selector.md +355 -0
- package/AI_USAGE/components/timeline-api.md +93 -0
- package/AI_USAGE/components/timeline.md +312 -0
- package/AI_USAGE/components/tooltip-api.md +77 -0
- package/AI_USAGE/components/tooltip.md +182 -0
- package/AI_USAGE/components/trend-chart-api.md +119 -0
- package/AI_USAGE/components/trend-chart.md +335 -0
- package/AI_USAGE/components/trigger-api.md +124 -0
- package/AI_USAGE/components/trigger.md +185 -0
- package/AI_USAGE/components/upload-api.md +200 -0
- package/AI_USAGE/components/upload.md +711 -3
- package/AI_USAGE/components/watermark-api.md +87 -0
- package/AI_USAGE/components/watermark.md +200 -0
- package/AI_USAGE/core.md +1 -1
- package/AI_USAGE/index.md +35 -7
- package/AI_USAGE/recipes/form-on-demand.md +1 -1
- package/AI_USAGE.md +33657 -7
- package/CHANGELOG.md +40 -0
- package/dist/_utils/inherit-component-type.d.ts +11 -0
- package/dist/components/date-picker/index.d.ts +420 -5
- package/dist/components/form-input/index.d.ts +617 -2
- package/dist/components/layout/index.d.ts +689 -1
- package/dist/components/menu/index.d.ts +786 -1
- package/dist/components/network/Network.vue.d.ts +7 -3
- package/dist/components/network/index.d.ts +10 -2
- package/dist/components/network/props.d.ts +5 -0
- package/dist/components/network/utils.d.ts +3 -3
- package/dist/components/pagination/page-item-ellipsis.vue.d.ts +4 -1
- package/dist/components/pagination/page-item-step.vue.d.ts +101 -130
- package/dist/components/pagination/page-item.vue.d.ts +1 -0
- package/dist/components/pagination/page-jumper.vue.d.ts +1 -1
- package/dist/components/pagination/page-options.vue.d.ts +6 -4
- package/dist/components/pagination/utils.d.ts +3 -0
- package/dist/components/time-range-selector/index.d.ts +6 -6
- package/dist/es/_container/resize-observer-v2.js +1 -1
- package/dist/es/_container/resize-observer.js +1 -1
- package/dist/es/_hooks/use-resize-observer.js +1 -1
- package/dist/es/_styles/palette-aliases.js +4 -4
- package/dist/es/_utils/inherit-component-type.js +6 -0
- package/dist/es/_virtual/advancedFormat.js +1 -1
- package/dist/es/_virtual/customParseFormat.js +1 -1
- package/dist/es/_virtual/dayjs.min.js +1 -1
- package/dist/es/_virtual/isBetween.js +1 -1
- package/dist/es/_virtual/quarterOfYear.js +1 -1
- package/dist/es/_virtual/weekOfYear.js +1 -1
- package/dist/es/_virtual/weekYear.js +1 -1
- package/dist/es/_virtual/zh-cn.js +1 -1
- package/dist/es/components/button/Button.js +53 -42
- package/dist/es/components/date-picker/index.js +18 -17
- package/dist/es/components/draggable/useDraggable.js +1 -1
- package/dist/es/components/form/Form.vue2.js +1 -1
- package/dist/es/components/form/FormItem.vue2.js +1 -1
- package/dist/es/components/form-input/index.js +12 -11
- package/dist/es/components/form-input-number/InputNumber.js +1 -1
- package/dist/es/components/form-slider/Slider.vue2.js +1 -1
- package/dist/es/components/form-slider/slider-ticks.vue2.js +1 -1
- package/dist/es/components/form-slider/utils.js +1 -1
- package/dist/es/components/layout/index.js +10 -9
- package/dist/es/components/menu/MenuItem.js +1 -1
- package/dist/es/components/menu/hooks/use-level.js +5 -5
- package/dist/es/components/menu/index.js +13 -10
- package/dist/es/components/menu/overflow-wrap.js +1 -1
- package/dist/es/components/network/Network.vue.js +17 -12
- package/dist/es/components/network/Network.vue2.js +78 -70
- package/dist/es/components/network/utils.js +112 -71
- package/dist/es/components/pagination/Pagination.js +132 -123
- package/dist/es/components/pagination/page-item-ellipsis.vue.js +10 -10
- package/dist/es/components/pagination/page-item-ellipsis.vue2.js +24 -19
- package/dist/es/components/pagination/page-item-step.vue.js +14 -11
- package/dist/es/components/pagination/page-item-step.vue2.js +20 -22
- package/dist/es/components/pagination/page-item.vue.js +10 -9
- package/dist/es/components/pagination/page-item.vue2.js +24 -19
- package/dist/es/components/pagination/page-jumper.vue2.js +23 -23
- package/dist/es/components/pagination/page-options.vue.js +15 -10
- package/dist/es/components/pagination/page-options.vue2.js +21 -17
- package/dist/es/components/pagination/utils.js +4 -2
- package/dist/es/components/progress/circle.vue2.js +1 -1
- package/dist/es/components/progress/line.vue2.js +1 -1
- package/dist/es/components/progress/steps.vue2.js +1 -1
- package/dist/es/components/rate/Rate.js +1 -1
- package/dist/es/components/virtual-list-v2/virtual-list-item.js +1 -1
- package/dist/es/locale/en-US.js +2 -0
- package/dist/es/locale/zh-CN.js +2 -0
- package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/dayjs.min.js +1 -1
- package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/locale/zh-cn.js +1 -1
- package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/plugin/advancedFormat.js +1 -1
- package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/plugin/customParseFormat.js +1 -1
- package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/plugin/isBetween.js +1 -1
- package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/plugin/quarterOfYear.js +1 -1
- package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/plugin/weekOfYear.js +1 -1
- package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/dayjs@1.11.21/node_modules/dayjs/plugin/weekYear.js +1 -1
- package/dist/es/style.css +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.umd.js +3 -3
- package/dist/locale/interface.d.ts +3 -0
- package/dist/style/base.css +1 -1
- package/dist/style/button.css +1 -1
- package/dist/style/form-select.css +1 -1
- package/dist/style/network.css +1 -1
- package/dist/style/pagination.css +1 -1
- package/dist/style/table.css +1 -1
- package/dist/style.css +1 -1
- package/package.json +10 -5
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/index.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/is.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/locale/en-US.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/array.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/base.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/boolean.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/custom.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/number.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/object.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/string.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/rules/type.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/b-validate@1.5.3/node_modules/b-validate/es/util.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/compute-scroll-into-view@3.1.1/node_modules/compute-scroll-into-view/dist/index.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/number-precision@1.6.0/node_modules/number-precision/build/index.es.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/scroll-into-view-if-needed@3.1.0/node_modules/scroll-into-view-if-needed/dist/index.js +0 -0
- /package/dist/es/{Users/xuyu/Code/x-next/node_modules → node_modules}/.pnpm/sortablejs@1.15.7/node_modules/sortablejs/modular/sortable.esm.js +0 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
|
+
# Draggable AI 使用
|
|
3
|
+
|
|
4
|
+
适用版本:x-next@1.14.0;来源指纹:`014984639d816a2c7e25eb22690c586b0b2e8efba6846bec8a4e424db41a09e9`。
|
|
5
|
+
|
|
6
|
+
先读 [通用接入](../core.md)。公开导出:`Draggable`;主要模型:v-model。完整 Props、Events、Slots、实例方法与服务签名见 [本地 API](./draggable-api.md),包含本组件族全部子组件和别名。
|
|
7
|
+
|
|
8
|
+
按需样式:`x-next/style/base.css`(包含 base.css)。代码块未单独引样式时在应用入口加载全量样式,或按实际所有组件加载 JS 入口;不要仅因复制一个组件页就漏掉其中的 Button 等组合依赖。
|
|
9
|
+
|
|
10
|
+
## 场景用法
|
|
11
|
+
|
|
12
|
+
以下示例从本地 `src/docs/components/draggable.md` 显式导入到独立 AI 源,补齐局部注册、状态和样式后进行严格模板检查。上方已核验行为优先;原始 prop 默认值、包装透传和示例业务适配分别查 [完整 API](./draggable-api.md) 与场景说明。类型通过不代表所有散文和交互已验证。
|
|
13
|
+
|
|
14
|
+
### 用途与选型
|
|
15
|
+
|
|
16
|
+
基于 SortableJS 封装的列表拖拽排序能力,适合任务排序、跨列表流转、物料选择和轻量级编排场景。
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### 何时使用
|
|
20
|
+
|
|
21
|
+
- 需要让用户调整一组同级数据的显示顺序。
|
|
22
|
+
- 需要在多个列表之间移动或复制条目。
|
|
23
|
+
- 需要组合 SortableJS 的高级能力,同时希望数据由 Vue 响应式状态驱动。
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### 基础用法
|
|
27
|
+
|
|
28
|
+
```vue
|
|
29
|
+
<script setup lang="ts">
|
|
30
|
+
import 'x-next/style.css';
|
|
31
|
+
import { Draggable } from 'x-next';
|
|
32
|
+
import { ref } from 'vue';
|
|
33
|
+
|
|
34
|
+
const list = ref([
|
|
35
|
+
{ id: 1, title: '需求评审' },
|
|
36
|
+
{ id: 2, title: '交互设计' },
|
|
37
|
+
{ id: 3, title: '组件实现' },
|
|
38
|
+
]);
|
|
39
|
+
</script>
|
|
40
|
+
<template>
|
|
41
|
+
<Draggable v-model="list" animation="150" ghost-class="ghost">
|
|
42
|
+
<div v-for="item in list" :key="item.id" class="item">
|
|
43
|
+
{{ item.title }}
|
|
44
|
+
</div>
|
|
45
|
+
</Draggable>
|
|
46
|
+
</template>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 拖拽手柄
|
|
50
|
+
|
|
51
|
+
```vue
|
|
52
|
+
<script setup lang="ts">
|
|
53
|
+
import 'x-next/style.css';
|
|
54
|
+
import { Draggable } from 'x-next';
|
|
55
|
+
import { computed, ref } from 'vue';
|
|
56
|
+
type Task = {
|
|
57
|
+
id: number;
|
|
58
|
+
title: string;
|
|
59
|
+
desc?: string;
|
|
60
|
+
locked?: boolean;
|
|
61
|
+
};
|
|
62
|
+
const handleList = ref<Task[]>([
|
|
63
|
+
{ id: 11, title: '表单校验' },
|
|
64
|
+
{ id: 12, title: '弹窗反馈' },
|
|
65
|
+
{ id: 13, title: '列表排序' },
|
|
66
|
+
]);
|
|
67
|
+
|
|
68
|
+
const list = handleList;
|
|
69
|
+
</script>
|
|
70
|
+
<template>
|
|
71
|
+
<Draggable v-model="list" handle=".drag-handle" animation="150">
|
|
72
|
+
<div v-for="item in list" :key="item.id">
|
|
73
|
+
<button class="drag-handle" type="button" aria-label="拖拽排序">⋮⋮</button>
|
|
74
|
+
<span>{{ item.title }}</span>
|
|
75
|
+
</div>
|
|
76
|
+
</Draggable>
|
|
77
|
+
</template>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 禁用状态
|
|
81
|
+
|
|
82
|
+
```vue
|
|
83
|
+
<script setup lang="ts">
|
|
84
|
+
import 'x-next/style.css';
|
|
85
|
+
import { Button, Draggable } from 'x-next';
|
|
86
|
+
import { ref } from 'vue';
|
|
87
|
+
|
|
88
|
+
const disabled = ref(false);
|
|
89
|
+
const list = ref([{ id: 1, title: '可拖拽项' }]);
|
|
90
|
+
</script>
|
|
91
|
+
<template>
|
|
92
|
+
<Button @click="disabled = !disabled">
|
|
93
|
+
{{ disabled ? '恢复拖拽' : '禁用拖拽' }}
|
|
94
|
+
</Button>
|
|
95
|
+
<Draggable v-model="list" :disabled="disabled">
|
|
96
|
+
<div v-for="item in list" :key="item.id">{{ item.title }}</div>
|
|
97
|
+
</Draggable>
|
|
98
|
+
</template>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 跨列表拖拽
|
|
102
|
+
|
|
103
|
+
```vue
|
|
104
|
+
<script setup lang="ts">
|
|
105
|
+
import 'x-next/style.css';
|
|
106
|
+
import { Draggable } from 'x-next';
|
|
107
|
+
import { computed, ref } from 'vue';
|
|
108
|
+
type Task = {
|
|
109
|
+
id: number;
|
|
110
|
+
title: string;
|
|
111
|
+
desc?: string;
|
|
112
|
+
locked?: boolean;
|
|
113
|
+
};
|
|
114
|
+
const todoList = ref<Task[]>([
|
|
115
|
+
{ id: 31, title: '补 Props 表' },
|
|
116
|
+
{ id: 32, title: '补 Events 表' },
|
|
117
|
+
{ id: 33, title: '补 Methods 表' },
|
|
118
|
+
]);
|
|
119
|
+
const doneList = ref<Task[]>([
|
|
120
|
+
{ id: 41, title: '基础示例' },
|
|
121
|
+
]);
|
|
122
|
+
|
|
123
|
+
const todo = todoList;
|
|
124
|
+
const done = doneList;
|
|
125
|
+
</script>
|
|
126
|
+
<template>
|
|
127
|
+
<Draggable
|
|
128
|
+
v-model="todo"
|
|
129
|
+
class="drop-list"
|
|
130
|
+
:group="{ name: 'tasks' }"
|
|
131
|
+
ghost-class="ghost"
|
|
132
|
+
chosen-class="chosen"
|
|
133
|
+
:empty-insert-threshold="48"
|
|
134
|
+
>
|
|
135
|
+
<div v-for="item in todo" :key="item.id">{{ item.title }}</div>
|
|
136
|
+
</Draggable>
|
|
137
|
+
<Draggable
|
|
138
|
+
v-model="done"
|
|
139
|
+
class="drop-list"
|
|
140
|
+
:group="{ name: 'tasks' }"
|
|
141
|
+
ghost-class="ghost"
|
|
142
|
+
chosen-class="chosen"
|
|
143
|
+
:empty-insert-threshold="48"
|
|
144
|
+
>
|
|
145
|
+
<div v-for="item in done" :key="item.id">{{ item.title }}</div>
|
|
146
|
+
</Draggable>
|
|
147
|
+
</template>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### 克隆模式
|
|
151
|
+
|
|
152
|
+
```vue
|
|
153
|
+
<script setup lang="ts">
|
|
154
|
+
import 'x-next/style.css';
|
|
155
|
+
import { Draggable } from 'x-next';
|
|
156
|
+
import { computed, ref } from 'vue';
|
|
157
|
+
type Task = {
|
|
158
|
+
id: number;
|
|
159
|
+
title: string;
|
|
160
|
+
desc?: string;
|
|
161
|
+
locked?: boolean;
|
|
162
|
+
};
|
|
163
|
+
const cloneSource = ref<Task[]>([
|
|
164
|
+
{ id: 51, title: '输入框' },
|
|
165
|
+
{ id: 52, title: '选择器' },
|
|
166
|
+
{ id: 53, title: '按钮' },
|
|
167
|
+
]);
|
|
168
|
+
const cloneTarget = ref<Task[]>([
|
|
169
|
+
{ id: 61, title: '表单区块' },
|
|
170
|
+
]);
|
|
171
|
+
let cloneId = 100;
|
|
172
|
+
const cloneTask = (item: Task) => ({
|
|
173
|
+
...item,
|
|
174
|
+
id: cloneId++,
|
|
175
|
+
title: `${item.title}副本`,
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
const source = cloneSource;
|
|
179
|
+
const target = cloneTarget;
|
|
180
|
+
const cloneItem = cloneTask;
|
|
181
|
+
</script>
|
|
182
|
+
<template>
|
|
183
|
+
<Draggable
|
|
184
|
+
v-model="source"
|
|
185
|
+
:group="{ name: 'builder', pull: 'clone', put: false }"
|
|
186
|
+
:sort="false"
|
|
187
|
+
:clone="cloneItem"
|
|
188
|
+
>
|
|
189
|
+
<div v-for="item in source" :key="item.id">{{ item.title }}</div>
|
|
190
|
+
</Draggable>
|
|
191
|
+
<Draggable
|
|
192
|
+
v-model="target"
|
|
193
|
+
class="drop-list"
|
|
194
|
+
:group="{ name: 'builder' }"
|
|
195
|
+
ghost-class="ghost"
|
|
196
|
+
:empty-insert-threshold="48"
|
|
197
|
+
>
|
|
198
|
+
<div v-for="item in target" :key="item.id">{{ item.title }}</div>
|
|
199
|
+
</Draggable>
|
|
200
|
+
</template>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### 事件与移动限制
|
|
204
|
+
|
|
205
|
+
```vue
|
|
206
|
+
<script setup lang="ts">
|
|
207
|
+
import 'x-next/style.css';
|
|
208
|
+
import { Draggable } from 'x-next';
|
|
209
|
+
import { ref } from 'vue';
|
|
210
|
+
|
|
211
|
+
const sortableList = ref([
|
|
212
|
+
{ id: 1, title: '可排序任务 A' },
|
|
213
|
+
{ id: 2, title: '可排序任务 B' },
|
|
214
|
+
{ id: 3, title: '可排序任务 C' },
|
|
215
|
+
]);
|
|
216
|
+
const allowMove = () => true;
|
|
217
|
+
const handleMove = (event: import('x-next').DraggableEvent) => {
|
|
218
|
+
console.log('move', event.oldDraggableIndex, event.newDraggableIndex);
|
|
219
|
+
};
|
|
220
|
+
const handleEnd = (event: import('x-next').DraggableEvent) => {
|
|
221
|
+
console.log(event.oldDraggableIndex, event.newDraggableIndex);
|
|
222
|
+
};
|
|
223
|
+
</script>
|
|
224
|
+
<template>
|
|
225
|
+
<div class="fixed-item">固定在顶部</div>
|
|
226
|
+
<Draggable v-model="sortableList" :allow-move="allowMove" @move="handleMove" @end="handleEnd">
|
|
227
|
+
<div v-for="item in sortableList" :key="item.id">
|
|
228
|
+
{{ item.title }}
|
|
229
|
+
</div>
|
|
230
|
+
</Draggable>
|
|
231
|
+
</template>
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### 指令用法
|
|
235
|
+
|
|
236
|
+
```vue
|
|
237
|
+
<script setup lang="ts">
|
|
238
|
+
import 'x-next/style.css';
|
|
239
|
+
import { vDraggable } from 'x-next';
|
|
240
|
+
import { ref } from 'vue';
|
|
241
|
+
|
|
242
|
+
const list = ref([{ id: 1, title: '指令挂载' }]);
|
|
243
|
+
</script>
|
|
244
|
+
<template>
|
|
245
|
+
<div v-draggable="[list, { animation: 150 }]">
|
|
246
|
+
<div v-for="item in list" :key="item.id">{{ item.title }}</div>
|
|
247
|
+
</div>
|
|
248
|
+
</template>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### 已知限制
|
|
252
|
+
|
|
253
|
+
- 当前键盘排序和屏幕阅读器提示仍需业务侧自行补充。
|
|
254
|
+
- `@move` 是 Vue 事件监听,若要通过返回 `false` 阻止移动,请使用 `:allow-move` 或 `:move-validator`。
|
|
255
|
+
- 使用 `draggable` / `filter` 时,列表数据应只对应可拖拽项。
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
返回 [AI 索引](../index.md)。先查本页与 [本地 API](./draggable-api.md);需要更深类型时查 [公开组件导航](../catalog.md),不默认上网查找本包用法。
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
|
+
# Drawer 完整公开 API
|
|
3
|
+
|
|
4
|
+
适用版本:x-next@1.14.0;来源指纹:`014984639d816a2c7e25eb22690c586b0b2e8efba6846bec8a4e424db41a09e9`。
|
|
5
|
+
|
|
6
|
+
从同版本构建的公开声明、运行时 props/emits 和显式 expose 生成。运行时导入始终使用 `x-next`,声明路径仅作定位。插槽类型未细化时,具体槽名与作用域见本地用法示例。
|
|
7
|
+
|
|
8
|
+
## Drawer API
|
|
9
|
+
|
|
10
|
+
公开声明:`dist/components/drawer/index.d.ts`。 类型中的 undefined 表示可省略;原始 prop 默认值不等于继承配置或服务默认值。
|
|
11
|
+
|
|
12
|
+
### Props
|
|
13
|
+
|
|
14
|
+
| 名称 | 用途 | 公开类型 | 必填 | 声明默认值 |
|
|
15
|
+
| --- | --- | --- | --- | --- |
|
|
16
|
+
| disabled | 是否禁用 Teleport | undefined | false | true | 否 | false |
|
|
17
|
+
| modelValue | 是否显示抽屉 | undefined | false | true | 否 | false |
|
|
18
|
+
| placement | 抽屉弹出位置 | undefined | "top" | "bottom" | "right" | "left" | 否 | "right" |
|
|
19
|
+
| title | 标题 | undefined | string | 否 | "" |
|
|
20
|
+
| mask | 是否显示遮罩 | undefined | false | true | 否 | true |
|
|
21
|
+
| showFooter | 是否显示底部操作区 | undefined | false | true | 否 | true |
|
|
22
|
+
| maskToClose | 点击遮罩是否关闭 | undefined | false | true | 否 | true |
|
|
23
|
+
| escToClose | 按下 Esc 是否关闭 | undefined | false | true | 否 | true |
|
|
24
|
+
| destroyOnClosed | 关闭后是否销毁内容 | undefined | false | true | 否 | true |
|
|
25
|
+
| width | 左右抽屉宽度 | undefined | string | number | 否 | 340 |
|
|
26
|
+
| height | 上下抽屉高度 | undefined | string | number | 否 | 340 |
|
|
27
|
+
| okText | 确认按钮文案 | undefined | string | 否 | "" |
|
|
28
|
+
| cancelText | 取消按钮文案 | undefined | string | 否 | "" |
|
|
29
|
+
| okLoading | 确认按钮是否 loading | undefined | false | true | 否 | false |
|
|
30
|
+
| okButtonProps | 确认按钮 props | undefined | { disabled?: boolean; block?: boolean; loading?: boolean; loadingFill?: boolean; debounce?: number; shape?: ButtonShape; link?: boolean; type?: ButtonTypes; htmlType?: ButtonHtmlType; status?: ButtonStatus; plain?: boolean; size?: ButtonSize; border?: boolean; narrow?: boolean; } | 否 | 未声明 |
|
|
31
|
+
| cancelButtonProps | 取消按钮 props | undefined | { disabled?: boolean; block?: boolean; loading?: boolean; loadingFill?: boolean; debounce?: number; shape?: ButtonShape; link?: boolean; type?: ButtonTypes; htmlType?: ButtonHtmlType; status?: ButtonStatus; plain?: boolean; size?: ButtonSize; border?: boolean; narrow?: boolean; } | 否 | 未声明 |
|
|
32
|
+
| hideCancel | 是否隐藏默认取消按钮 | undefined | false | true | 否 | false |
|
|
33
|
+
| onBeforeOk | 确认前拦截,返回 false 阻止关闭 | undefined | (event?: Event) => boolean | void | Promise<boolean | void> | 否 | 未声明 |
|
|
34
|
+
| onBeforeCancel | 取消前拦截,返回 false 阻止关闭 | undefined | (event?: Event) => boolean | void | Promise<boolean | void> | 否 | 未声明 |
|
|
35
|
+
| renderTo | 挂载容器 | undefined | string | HTMLElement | 否 | "body" |
|
|
36
|
+
| popupClass | 最外层自定义类名 | undefined | string | 否 | undefined |
|
|
37
|
+
| drawerStyle | 最外层样式 | undefined | CSSProperties | 否 | 未声明 |
|
|
38
|
+
| bodyClass | body 自定义类名 | undefined | string | { [x: string]: any; } | unknown[] | 否 | 未声明 |
|
|
39
|
+
| bodyStyle | body 自定义样式 | undefined | null | string | false | CSSProperties | StyleValue[] | 否 | 未声明 |
|
|
40
|
+
| showClose | 是否显示关闭按钮 | undefined | false | true | 否 | true |
|
|
41
|
+
|
|
42
|
+
### Events
|
|
43
|
+
|
|
44
|
+
| 事件 | 用途 | 监听器签名(即事件参数) |
|
|
45
|
+
| --- | --- | --- |
|
|
46
|
+
| update:modelValue | 显隐状态变化时触发 | undefined | (...args: any[]) => any |
|
|
47
|
+
| close | 请求关闭且未被拦截时触发 | undefined | (...args: any[]) => any |
|
|
48
|
+
| closed | 关闭动画结束后触发 | undefined | (...args: any[]) => any |
|
|
49
|
+
| open | 打开时触发 | undefined | (...args: any[]) => any |
|
|
50
|
+
| opened | 打开动画结束后触发 | undefined | (...args: any[]) => any |
|
|
51
|
+
| ok | 点击确认且未被拦截时触发 | undefined | (...args: any[]) => any |
|
|
52
|
+
| cancel | 点击取消、关闭、遮罩或 Esc 且未被拦截时触发 | undefined | (...args: any[]) => any |
|
|
53
|
+
| beforeCancel | 见场景用法与类型 | undefined | (event?: Event) => boolean | void | Promise<boolean | void> |
|
|
54
|
+
| beforeOk | 见场景用法与类型 | undefined | (event?: Event) => boolean | void | Promise<boolean | void> |
|
|
55
|
+
|
|
56
|
+
### Slots
|
|
57
|
+
|
|
58
|
+
| 名称 | 用途 | 公开类型 |
|
|
59
|
+
| --- | --- | --- |
|
|
60
|
+
| default | 抽屉主体内容 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
61
|
+
| title | 自定义标题 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
62
|
+
| footer | 自定义底部操作区 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
63
|
+
| fill | 完全自定义抽屉内部结构 | 文档列出的实际插槽;公开类型未细化,作用域见场景用法 |
|
|
64
|
+
|
|
65
|
+
### 实例方法
|
|
66
|
+
|
|
67
|
+
没有检索到显式 expose 或 Options API methods 的公开方法;不把 setup 内部函数当成稳定实例 API。
|
|
68
|
+
|
|
69
|
+
### 关联类型定义
|
|
70
|
+
|
|
71
|
+
以下摘自本组件族声明,供查阅嵌套配置;运行时和值类型均以根入口可导出项为准。
|
|
72
|
+
|
|
73
|
+
```typescript-reference
|
|
74
|
+
type Placement = 'top' | 'right' | 'bottom' | 'left';
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
返回 [Drawer 用法](./drawer.md)。
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
<!-- Generated by pnpm generate:ai-usage. Edit script/ai-usage/content.md and script/ai-usage/. -->
|
|
2
|
+
# Drawer AI 使用
|
|
3
|
+
|
|
4
|
+
适用版本:x-next@1.14.0;来源指纹:`014984639d816a2c7e25eb22690c586b0b2e8efba6846bec8a4e424db41a09e9`。
|
|
5
|
+
|
|
6
|
+
先读 [通用接入](../core.md)。公开导出:`Drawer`;主要模型:v-model。完整 Props、Events、Slots、实例方法与服务签名见 [本地 API](./drawer-api.md),包含本组件族全部子组件和别名。
|
|
7
|
+
|
|
8
|
+
按需样式:`x-next/style/drawer`(包含 base.css、button.css、drawer.css、scrollbar-v2.css、space.css)。代码块未单独引样式时在应用入口加载全量样式,或按实际所有组件加载 JS 入口;不要仅因复制一个组件页就漏掉其中的 Button 等组合依赖。
|
|
9
|
+
|
|
10
|
+
## 场景用法
|
|
11
|
+
|
|
12
|
+
以下示例从本地 `src/docs/components/drawer.md` 显式导入到独立 AI 源,补齐局部注册、状态和样式后进行严格模板检查。上方已核验行为优先;原始 prop 默认值、包装透传和示例业务适配分别查 [完整 API](./drawer-api.md) 与场景说明。类型通过不代表所有散文和交互已验证。
|
|
13
|
+
|
|
14
|
+
### 用途与选型
|
|
15
|
+
|
|
16
|
+
从屏幕边缘展开内容,适合详情、编辑和辅助配置。
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### 何时使用
|
|
20
|
+
|
|
21
|
+
- 需要在不离开当前页面的情况下查看详情、编辑表单或配置参数。
|
|
22
|
+
- 内容比 Popconfirm、Tooltip 更复杂,但又不需要 Dialog 那样强打断。
|
|
23
|
+
- 希望任务完成后回到原页面上下文。
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### 基础用法
|
|
27
|
+
|
|
28
|
+
```vue
|
|
29
|
+
<script setup lang="ts">
|
|
30
|
+
import 'x-next/style.css';
|
|
31
|
+
import { Button, Drawer } from 'x-next';
|
|
32
|
+
import { ref } from 'vue';
|
|
33
|
+
|
|
34
|
+
const visible = ref(false);
|
|
35
|
+
</script>
|
|
36
|
+
<template>
|
|
37
|
+
<Button type="primary" @click="visible = true">打开抽屉</Button>
|
|
38
|
+
<Drawer v-model="visible" title="详情">
|
|
39
|
+
抽屉内容
|
|
40
|
+
</Drawer>
|
|
41
|
+
</template>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 位置与尺寸
|
|
45
|
+
|
|
46
|
+
```vue
|
|
47
|
+
<script setup lang="ts">
|
|
48
|
+
import 'x-next/style.css';
|
|
49
|
+
import { Drawer } from 'x-next';
|
|
50
|
+
import { ref } from 'vue';
|
|
51
|
+
const rightVisible = ref(false);
|
|
52
|
+
|
|
53
|
+
const visible = rightVisible;
|
|
54
|
+
</script>
|
|
55
|
+
<template>
|
|
56
|
+
<Drawer v-model="visible" placement="bottom" height="300px" title="底部抽屉">
|
|
57
|
+
内容
|
|
58
|
+
</Drawer>
|
|
59
|
+
</template>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 受控与事件
|
|
63
|
+
|
|
64
|
+
```vue
|
|
65
|
+
<script setup lang="ts">
|
|
66
|
+
import 'x-next/style.css';
|
|
67
|
+
import { Drawer } from 'x-next';
|
|
68
|
+
import { ref } from 'vue';
|
|
69
|
+
|
|
70
|
+
const visible = ref(false);
|
|
71
|
+
const handleOk = (event?: Event) => console.log('ok', event);
|
|
72
|
+
const handleCancel = (event?: Event) => console.log('cancel', event);
|
|
73
|
+
const handleClose = (action: 'ok' | 'cancel', event?: Event) => console.log(action, event);
|
|
74
|
+
</script>
|
|
75
|
+
<template>
|
|
76
|
+
<Drawer
|
|
77
|
+
v-model="visible"
|
|
78
|
+
title="事件记录"
|
|
79
|
+
@ok="handleOk"
|
|
80
|
+
@cancel="handleCancel"
|
|
81
|
+
@close="handleClose"
|
|
82
|
+
>
|
|
83
|
+
内容
|
|
84
|
+
</Drawer>
|
|
85
|
+
</template>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 异步关闭
|
|
89
|
+
|
|
90
|
+
等待期间确认、取消、关闭图标、遮罩和 Escape 共用防重保护;重复操作不会再次调用拦截回调。回调返回 false、抛错或拒绝时保持打开。外部关闭后重新打开,旧等待结果不会关闭新一轮。
|
|
91
|
+
|
|
92
|
+
```vue
|
|
93
|
+
<script setup lang="ts">
|
|
94
|
+
import 'x-next/style.css';
|
|
95
|
+
import { Drawer } from 'x-next';
|
|
96
|
+
import { ref } from 'vue';
|
|
97
|
+
const visible = ref(false);
|
|
98
|
+
const beforeOk = async () => {
|
|
99
|
+
await new Promise((resolve) => window.setTimeout(resolve, 1000));
|
|
100
|
+
return true;
|
|
101
|
+
};
|
|
102
|
+
</script>
|
|
103
|
+
<template>
|
|
104
|
+
<Drawer v-model="visible" title="提交确认" :on-before-ok="beforeOk">
|
|
105
|
+
点击确认后等待异步校验。
|
|
106
|
+
</Drawer>
|
|
107
|
+
</template>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 嵌套浮层、卸载与键盘
|
|
111
|
+
|
|
112
|
+
打开 Drawer 后进入首个可聚焦元素,有遮罩时 Tab / Shift+Tab 在内部循环;无遮罩时不限制 Tab。关闭或卸载后归还原焦点,已移到其他交互区域的焦点会保留。无标题或使用 fill 时,可用 `aria-label` / `aria-labelledby` 给对话框命名。
|
|
113
|
+
|
|
114
|
+
Drawer 与 Dialog 共用顺序焦点规则:正 tabindex 排序后再进入默认顺序,具名原生 radio 组优先进入选中项;建议保持默认 DOM 顺序。用键盘激活打开按钮可验证焦点归还。Button 鼠标点击会主动 blur,打开前焦点可能为 body,此时没有按钮焦点可归还。
|
|
115
|
+
|
|
116
|
+
```vue
|
|
117
|
+
<script setup lang="ts">
|
|
118
|
+
import 'x-next/style.css';
|
|
119
|
+
import { Button, DialogComponent, Drawer, Input } from 'x-next';
|
|
120
|
+
import { ref } from 'vue';
|
|
121
|
+
const dialog = ref(false);
|
|
122
|
+
const drawer = ref(false);
|
|
123
|
+
const mounted = ref(true);
|
|
124
|
+
import type { InputHTMLAttributes } from 'vue';
|
|
125
|
+
const nativeAttrs1 = { "aria-label": "抽屉内容" } satisfies InputHTMLAttributes;
|
|
126
|
+
</script>
|
|
127
|
+
<template>
|
|
128
|
+
<Button @click="dialog = true">打开底层 Dialog</Button>
|
|
129
|
+
<DialogComponent v-model="dialog" title="底层对话框">
|
|
130
|
+
<Button @click="mounted = true; drawer = true">打开上层 Drawer</Button>
|
|
131
|
+
<p>卸载 Drawer 后,在此按 Escape 可以继续关闭。</p>
|
|
132
|
+
<Drawer v-if="mounted" v-model="drawer" title="上层抽屉" :show-footer="false">
|
|
133
|
+
<Input :input-attrs="nativeAttrs1" placeholder="Tab 检查焦点循环" />
|
|
134
|
+
<Button @click="mounted = false; drawer = false">直接卸载本层</Button>
|
|
135
|
+
</Drawer>
|
|
136
|
+
</DialogComponent>
|
|
137
|
+
</template>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 遮罩和关闭
|
|
141
|
+
|
|
142
|
+
```vue
|
|
143
|
+
<script setup lang="ts">
|
|
144
|
+
import 'x-next/style.css';
|
|
145
|
+
import { Drawer } from 'x-next';
|
|
146
|
+
import { ref } from 'vue';
|
|
147
|
+
const maskVisible = ref(false);
|
|
148
|
+
|
|
149
|
+
const visible = maskVisible;
|
|
150
|
+
</script>
|
|
151
|
+
<template>
|
|
152
|
+
<Drawer
|
|
153
|
+
v-model="visible"
|
|
154
|
+
title="无遮罩"
|
|
155
|
+
:mask="false"
|
|
156
|
+
:mask-to-close="false"
|
|
157
|
+
:esc-to-close="false"
|
|
158
|
+
:show-close="false"
|
|
159
|
+
>
|
|
160
|
+
内容
|
|
161
|
+
</Drawer>
|
|
162
|
+
</template>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### 自定义 Footer
|
|
166
|
+
|
|
167
|
+
```vue
|
|
168
|
+
<script setup lang="ts">
|
|
169
|
+
import 'x-next/style.css';
|
|
170
|
+
import { Drawer, Space, Button } from 'x-next';
|
|
171
|
+
import { ref } from 'vue';
|
|
172
|
+
const footerVisible = ref(false);
|
|
173
|
+
|
|
174
|
+
const visible = footerVisible;
|
|
175
|
+
</script>
|
|
176
|
+
<template>
|
|
177
|
+
<Drawer v-model="visible" title="自定义 Footer">
|
|
178
|
+
内容
|
|
179
|
+
<template #footer="{ ok, cancel, loadingObj }">
|
|
180
|
+
<Space>
|
|
181
|
+
<Button type="text" :loading="loadingObj.cancel" @click="cancel">
|
|
182
|
+
稍后处理
|
|
183
|
+
</Button>
|
|
184
|
+
<Button type="primary" :loading="loadingObj.ok" @click="ok">
|
|
185
|
+
保存
|
|
186
|
+
</Button>
|
|
187
|
+
</Space>
|
|
188
|
+
</template>
|
|
189
|
+
</Drawer>
|
|
190
|
+
</template>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### 局部容器
|
|
194
|
+
|
|
195
|
+
```vue
|
|
196
|
+
<script setup lang="ts">
|
|
197
|
+
import 'x-next/style.css';
|
|
198
|
+
import { Button, Drawer } from 'x-next';
|
|
199
|
+
import { ref } from 'vue';
|
|
200
|
+
const localVisible = ref(false);
|
|
201
|
+
|
|
202
|
+
const visible = localVisible;
|
|
203
|
+
</script>
|
|
204
|
+
<template>
|
|
205
|
+
<Button @click="visible = true">打开局部抽屉</Button>
|
|
206
|
+
<div id="drawer-local-container" class="demo-drawer-local-container">
|
|
207
|
+
局部容器
|
|
208
|
+
</div>
|
|
209
|
+
<Drawer
|
|
210
|
+
v-model="visible"
|
|
211
|
+
render-to="#drawer-local-container"
|
|
212
|
+
title="局部抽屉"
|
|
213
|
+
width="260px"
|
|
214
|
+
>
|
|
215
|
+
内容
|
|
216
|
+
</Drawer>
|
|
217
|
+
</template>
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### 已知限制
|
|
221
|
+
|
|
222
|
+
- 当前暂不提供命令式 `Drawer.open()`。
|
|
223
|
+
- 多层 Drawer push、`extra`、自定义关闭图标等能力后续再评估。
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
返回 [AI 索引](../index.md)。先查本页与 [本地 API](./drawer-api.md);需要更深类型时查 [公开组件导航](../catalog.md),不默认上网查找本包用法。
|