@a2simcode/ui 0.0.46 → 0.0.48
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/.cursor/skills/ui-component-helper/README.md +43 -0
- package/.cursor/skills/ui-component-helper/SKILL.md +81 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/simcode-ui.es.js +222 -195
- package/dist/simcode-ui.umd.js +2 -2
- package/dist/stats.html +1 -1
- package/docs/components/autocomplete.md +89 -0
- package/docs/components/barcode.md +101 -0
- package/docs/components/button-select.md +24 -0
- package/docs/components/button.md +117 -0
- package/docs/components/buttons.md +119 -0
- package/docs/components/cascader-select.md +114 -0
- package/docs/components/checkbox.md +114 -0
- package/docs/components/code-mirror.md +85 -0
- package/docs/components/collapse.md +26 -0
- package/docs/components/comp.md +71 -0
- package/docs/components/count-up.md +24 -0
- package/docs/components/count.md +24 -0
- package/docs/components/data-panel.md +24 -0
- package/docs/components/dialog-full.md +112 -0
- package/docs/components/dialog.md +127 -0
- package/docs/components/divider.md +24 -0
- package/docs/components/drawer.md +127 -0
- package/docs/components/dynamic-layer.md +118 -0
- package/docs/components/echarts.md +72 -0
- package/docs/components/editor.md +24 -0
- package/docs/components/form.md +27 -0
- package/docs/components/guid.md +39 -0
- package/docs/components/hpanel.md +24 -0
- package/docs/components/icon.md +56 -0
- package/docs/components/input-button.md +24 -0
- package/docs/components/input-code.md +24 -0
- package/docs/components/input-color.md +114 -0
- package/docs/components/input-layer.md +26 -0
- package/docs/components/input-rows.md +370 -0
- package/docs/components/input-tag.md +50 -0
- package/docs/components/input.md +129 -0
- package/docs/components/layer-form.md +61 -0
- package/docs/components/layer.md +127 -0
- package/docs/components/layout.md +132 -0
- package/docs/components/map.md +24 -0
- package/docs/components/menu.md +121 -0
- package/docs/components/meta/autocomplete.ts +335 -0
- package/docs/components/meta/barcode.ts +216 -0
- package/docs/components/meta/button-select.ts +94 -0
- package/docs/components/meta/button.ts +123 -0
- package/docs/components/meta/buttons.ts +56 -0
- package/docs/components/meta/cascader-select.ts +328 -0
- package/docs/components/meta/checkbox.ts +194 -0
- package/docs/components/meta/code-mirror.ts +108 -0
- package/docs/components/meta/collapse.ts +52 -0
- package/docs/components/meta/comp.ts +224 -0
- package/docs/components/meta/count-up.ts +126 -0
- package/docs/components/meta/count.ts +113 -0
- package/docs/components/meta/data-panel.ts +34 -0
- package/docs/components/meta/dialog-full.ts +133 -0
- package/docs/components/meta/dialog.ts +175 -0
- package/docs/components/meta/divider.ts +66 -0
- package/docs/components/meta/drawer.ts +158 -0
- package/docs/components/meta/dynamic-layer.ts +99 -0
- package/docs/components/meta/echarts.ts +64 -0
- package/docs/components/meta/editor.ts +67 -0
- package/docs/components/meta/form-item.ts +50 -0
- package/docs/components/meta/form.ts +160 -0
- package/docs/components/meta/guid.ts +42 -0
- package/docs/components/meta/hpanel.ts +20 -0
- package/docs/components/meta/icon.ts +68 -0
- package/docs/components/meta/input-button.ts +165 -0
- package/docs/components/meta/input-code.ts +151 -0
- package/docs/components/meta/input-color.ts +243 -0
- package/docs/components/meta/input-layer.ts +336 -0
- package/docs/components/meta/input-rows.ts +113 -0
- package/docs/components/meta/input-tag.ts +112 -0
- package/docs/components/meta/input.ts +411 -0
- package/docs/components/meta/layer-form.ts +56 -0
- package/docs/components/meta/layer.ts +122 -0
- package/docs/components/meta/layout.ts +101 -0
- package/docs/components/meta/map.ts +68 -0
- package/docs/components/meta/menu.ts +43 -0
- package/docs/components/meta/number.ts +296 -0
- package/docs/components/meta/page.ts +67 -0
- package/docs/components/meta/radio.ts +55 -0
- package/docs/components/meta/rate.ts +124 -0
- package/docs/components/meta/select.ts +279 -0
- package/docs/components/meta/slider-captcha.ts +70 -0
- package/docs/components/meta/slider.ts +270 -0
- package/docs/components/meta/switch.ts +272 -0
- package/docs/components/meta/table-panel.ts +154 -0
- package/docs/components/meta/table.ts +328 -0
- package/docs/components/meta/tabs.ts +136 -0
- package/docs/components/meta/title.ts +80 -0
- package/docs/components/meta/tree.ts +242 -0
- package/docs/components/meta/upload.ts +186 -0
- package/docs/components/meta/workflow-viewer.ts +55 -0
- package/docs/components/meta/workflow.ts +113 -0
- package/docs/components/number.md +124 -0
- package/docs/components/page.md +42 -0
- package/docs/components/radio.md +87 -0
- package/docs/components/rate.md +71 -0
- package/docs/components/select.md +133 -0
- package/docs/components/slider-captcha.md +41 -0
- package/docs/components/slider.md +101 -0
- package/docs/components/switch.md +90 -0
- package/docs/components/table-panel.md +199 -0
- package/docs/components/table.md +202 -0
- package/docs/components/tabs.md +26 -0
- package/docs/components/title.md +24 -0
- package/docs/components/tree.md +207 -0
- package/docs/components/upload.md +117 -0
- package/docs/components/workflow-viewer.md +21 -0
- package/docs/components/workflow.md +21 -0
- package/docs/examples/autocomplete/advanced.vue +35 -0
- package/docs/examples/autocomplete/basic.vue +32 -0
- package/docs/examples/autocomplete/clearable.vue +33 -0
- package/docs/examples/autocomplete/custom-template.vue +49 -0
- package/docs/examples/autocomplete/disabled.vue +33 -0
- package/docs/examples/autocomplete/icon.vue +37 -0
- package/docs/examples/barcode/all-types.vue +380 -0
- package/docs/examples/barcode/basic.vue +14 -0
- package/docs/examples/barcode/props-appearance.vue +243 -0
- package/docs/examples/barcode/props-geometry.vue +143 -0
- package/docs/examples/barcode/props-logic.vue +216 -0
- package/docs/examples/barcode/props-symbology.vue +199 -0
- package/docs/examples/barcode/props-text.vue +268 -0
- package/docs/examples/button/basic.vue +7 -0
- package/docs/examples/button/danger-ghost.vue +17 -0
- package/docs/examples/button/disabled.vue +10 -0
- package/docs/examples/button/loading.vue +6 -0
- package/docs/examples/button/shape.vue +7 -0
- package/docs/examples/button/size.vue +14 -0
- package/docs/examples/button/type.vue +9 -0
- package/docs/examples/button-select/basic.vue +19 -0
- package/docs/examples/buttons/basic.vue +45 -0
- package/docs/examples/buttons/disabled.vue +36 -0
- package/docs/examples/buttons/dropdown.vue +63 -0
- package/docs/examples/buttons/group.vue +52 -0
- package/docs/examples/buttons/link.vue +47 -0
- package/docs/examples/buttons/popup.vue +39 -0
- package/docs/examples/buttons/size.vue +45 -0
- package/docs/examples/cascader-select/basic.vue +28 -0
- package/docs/examples/cascader-select/clearable.vue +34 -0
- package/docs/examples/cascader-select/disabled.vue +43 -0
- package/docs/examples/cascader-select/filterable.vue +37 -0
- package/docs/examples/cascader-select/methods.vue +84 -0
- package/docs/examples/cascader-select/multiple.vue +38 -0
- package/docs/examples/cascader-select/slot.vue +45 -0
- package/docs/examples/checkbox/basic.vue +18 -0
- package/docs/examples/checkbox/button.vue +19 -0
- package/docs/examples/checkbox/color.vue +25 -0
- package/docs/examples/checkbox/disabled.vue +17 -0
- package/docs/examples/checkbox/min-max.vue +20 -0
- package/docs/examples/checkbox/mixed.vue +56 -0
- package/docs/examples/checkbox/size.vue +28 -0
- package/docs/examples/code-mirror/basic.vue +11 -0
- package/docs/examples/code-mirror/events.vue +42 -0
- package/docs/examples/code-mirror/height.vue +25 -0
- package/docs/examples/code-mirror/mode.vue +33 -0
- package/docs/examples/code-mirror/readonly.vue +14 -0
- package/docs/examples/collapse/basic.vue +82 -0
- package/docs/examples/comp/basic.vue +7 -0
- package/docs/examples/comp/collapse.vue +38 -0
- package/docs/examples/comp/tabs.vue +38 -0
- package/docs/examples/count/basic.vue +54 -0
- package/docs/examples/count-up/basic.vue +89 -0
- package/docs/examples/data-panel/basic.vue +110 -0
- package/docs/examples/dialog/basic.vue +36 -0
- package/docs/examples/dialog/custom-buttons.vue +44 -0
- package/docs/examples/dialog/fullscreen.vue +23 -0
- package/docs/examples/dialog/no-mask.vue +17 -0
- package/docs/examples/dialog/size.vue +44 -0
- package/docs/examples/dialog/steps.vue +57 -0
- package/docs/examples/dialog-full/basic.vue +29 -0
- package/docs/examples/dialog-full/custom-buttons.vue +45 -0
- package/docs/examples/dialog-full/no-buttons.vue +18 -0
- package/docs/examples/dialog-full/no-header.vue +27 -0
- package/docs/examples/dialog-full/steps.vue +71 -0
- package/docs/examples/divider/basic.vue +52 -0
- package/docs/examples/drawer/basic.vue +35 -0
- package/docs/examples/drawer/custom-buttons.vue +34 -0
- package/docs/examples/drawer/direction.vue +47 -0
- package/docs/examples/drawer/mask.vue +36 -0
- package/docs/examples/drawer/no-buttons.vue +20 -0
- package/docs/examples/drawer/size.vue +28 -0
- package/docs/examples/dynamic-layer/basic.vue +33 -0
- package/docs/examples/dynamic-layer/custom-buttons.vue +43 -0
- package/docs/examples/dynamic-layer/form.vue +73 -0
- package/docs/examples/dynamic-layer/steps.vue +52 -0
- package/docs/examples/dynamic-layer/types.vue +40 -0
- package/docs/examples/echarts/basic.vue +31 -0
- package/docs/examples/echarts/dynamic.vue +43 -0
- package/docs/examples/echarts/line.vue +46 -0
- package/docs/examples/echarts/pie.vue +44 -0
- package/docs/examples/editor/basic.vue +15 -0
- package/docs/examples/form/basic.vue +224 -0
- package/docs/examples/guid/basic.vue +10 -0
- package/docs/examples/guid/size.vue +13 -0
- package/docs/examples/hpanel/basic.vue +79 -0
- package/docs/examples/icon/basic.vue +9 -0
- package/docs/examples/icon/rotate-flip.vue +9 -0
- package/docs/examples/icon/size.vue +7 -0
- package/docs/examples/input/basic.vue +10 -0
- package/docs/examples/input/clearable.vue +12 -0
- package/docs/examples/input/disabled.vue +6 -0
- package/docs/examples/input/icon.vue +23 -0
- package/docs/examples/input/password.vue +18 -0
- package/docs/examples/input/size.vue +13 -0
- package/docs/examples/input/textarea.vue +25 -0
- package/docs/examples/input/word-limit.vue +28 -0
- package/docs/examples/input-button/basic.vue +33 -0
- package/docs/examples/input-code/basic.vue +29 -0
- package/docs/examples/input-color/basic.vue +10 -0
- package/docs/examples/input-color/disabled.vue +13 -0
- package/docs/examples/input-color/format.vue +17 -0
- package/docs/examples/input-color/no-alpha.vue +13 -0
- package/docs/examples/input-color/only-button.vue +15 -0
- package/docs/examples/input-color/predefine.vue +31 -0
- package/docs/examples/input-color/size.vue +15 -0
- package/docs/examples/input-layer/basic.vue +69 -0
- package/docs/examples/input-rows/basic.vue +73 -0
- package/docs/examples/input-rows/drag.vue +48 -0
- package/docs/examples/input-rows/layer-form.vue +85 -0
- package/docs/examples/input-rows/nested.vue +91 -0
- package/docs/examples/input-tag/basic.vue +27 -0
- package/docs/examples/input-tag/colors.vue +23 -0
- package/docs/examples/input-tag/readonly.vue +17 -0
- package/docs/examples/layer/basic.vue +43 -0
- package/docs/examples/layer/custom-buttons.vue +61 -0
- package/docs/examples/layer/drawer.vue +37 -0
- package/docs/examples/layer/full.vue +38 -0
- package/docs/examples/layer/modal.vue +34 -0
- package/docs/examples/layer/steps.vue +46 -0
- package/docs/examples/layer-form/basic.vue +76 -0
- package/docs/examples/layer-form/config.vue +82 -0
- package/docs/examples/layer-form/size.vue +72 -0
- package/docs/examples/layout/basic.vue +36 -0
- package/docs/examples/layout/custom-size.vue +50 -0
- package/docs/examples/layout/disable-move.vue +37 -0
- package/docs/examples/layout/hide-mid-when-narrow.vue +96 -0
- package/docs/examples/layout/min-size.vue +73 -0
- package/docs/examples/layout/percent-size.vue +80 -0
- package/docs/examples/layout/simple.vue +22 -0
- package/docs/examples/layout/top-side.vue +34 -0
- package/docs/examples/map/basic.vue +22 -0
- package/docs/examples/menu/basic.vue +58 -0
- package/docs/examples/menu/collapsed.vue +49 -0
- package/docs/examples/menu/horizontal.vue +44 -0
- package/docs/examples/menu/selection-test.vue +104 -0
- package/docs/examples/menu/theme.vue +46 -0
- package/docs/examples/menu/vertical.vue +46 -0
- package/docs/examples/number/advanced.vue +143 -0
- package/docs/examples/number/basic.vue +63 -0
- package/docs/examples/number/disabled.vue +49 -0
- package/docs/examples/number/size.vue +42 -0
- package/docs/examples/number/slots.vue +123 -0
- package/docs/examples/number/step-strictly.vue +41 -0
- package/docs/examples/number/step.vue +47 -0
- package/docs/examples/page/basic.vue +41 -0
- package/docs/examples/page/init.vue +87 -0
- package/docs/examples/radio/basic.vue +17 -0
- package/docs/examples/radio/button.vue +17 -0
- package/docs/examples/radio/color.vue +18 -0
- package/docs/examples/radio/disabled.vue +17 -0
- package/docs/examples/radio/size.vue +29 -0
- package/docs/examples/rate/basic.vue +24 -0
- package/docs/examples/rate/half.vue +24 -0
- package/docs/examples/rate/readonly.vue +11 -0
- package/docs/examples/rate/text.vue +32 -0
- package/docs/examples/select/basic.vue +16 -0
- package/docs/examples/select/clearable.vue +22 -0
- package/docs/examples/select/disabled.vue +31 -0
- package/docs/examples/select/filterable.vue +24 -0
- package/docs/examples/select/group.vue +23 -0
- package/docs/examples/select/icon.vue +16 -0
- package/docs/examples/select/multiple.vue +18 -0
- package/docs/examples/select/size.vue +39 -0
- package/docs/examples/slider/basic.vue +42 -0
- package/docs/examples/slider/disabled.vue +17 -0
- package/docs/examples/slider/marks.vue +30 -0
- package/docs/examples/slider/size.vue +37 -0
- package/docs/examples/slider/tooltip.vue +36 -0
- package/docs/examples/slider/vertical.vue +26 -0
- package/docs/examples/slider-captcha/basic.vue +44 -0
- package/docs/examples/slider-captcha/custom.vue +48 -0
- package/docs/examples/switch/basic.vue +16 -0
- package/docs/examples/switch/disabled.vue +13 -0
- package/docs/examples/switch/loading.vue +13 -0
- package/docs/examples/switch/size.vue +15 -0
- package/docs/examples/switch/text.vue +13 -0
- package/docs/examples/table/actions.vue +116 -0
- package/docs/examples/table/add-row.vue +103 -0
- package/docs/examples/table/basic.vue +168 -0
- package/docs/examples/table/editable.vue +261 -0
- package/docs/examples/table/field-selection.vue +87 -0
- package/docs/examples/table/frozen-column.vue +140 -0
- package/docs/examples/table/height-mode.vue +99 -0
- package/docs/examples/table/multiple.vue +178 -0
- package/docs/examples/table/pagination.vue +151 -0
- package/docs/examples/table/single-selection.vue +64 -0
- package/docs/examples/table/tree-column.vue +119 -0
- package/docs/examples/table/tree-data.vue +141 -0
- package/docs/examples/table-panel/basic.vue +228 -0
- package/docs/examples/table-panel/batch-operations.vue +285 -0
- package/docs/examples/table-panel/filter.vue +209 -0
- package/docs/examples/table-panel/multiple-selection.vue +243 -0
- package/docs/examples/table-panel/pagination.vue +133 -0
- package/docs/examples/tabs/basic.vue +98 -0
- package/docs/examples/title/basic.vue +80 -0
- package/docs/examples/tree/accordion.vue +46 -0
- package/docs/examples/tree/basic.vue +50 -0
- package/docs/examples/tree/buttons.vue +53 -0
- package/docs/examples/tree/checkable.vue +52 -0
- package/docs/examples/tree/custom-keys.vue +39 -0
- package/docs/examples/tree/default-expanded.vue +52 -0
- package/docs/examples/tree/draggable.vue +29 -0
- package/docs/examples/tree/expand-on-click.vue +39 -0
- package/docs/examples/tree/flat-data.vue +20 -0
- package/docs/examples/tree/icon.vue +40 -0
- package/docs/examples/tree/load-data.vue +37 -0
- package/docs/examples/tree/methods.vue +74 -0
- package/docs/examples/tree/theme.vue +33 -0
- package/docs/examples/upload/accept.vue +31 -0
- package/docs/examples/upload/basic.vue +12 -0
- package/docs/examples/upload/drag.vue +11 -0
- package/docs/examples/upload/image.vue +17 -0
- package/docs/examples/upload/limit.vue +20 -0
- package/docs/examples/upload/multiple.vue +17 -0
- package/docs/examples/upload/readonly.vue +17 -0
- package/docs/examples/utils/cipher.vue +160 -0
- package/docs/examples/utils/common.vue +153 -0
- package/docs/examples/utils/date.vue +56 -0
- package/docs/examples/utils/dom.vue +52 -0
- package/docs/examples/utils/is.vue +70 -0
- package/docs/examples/workflow/basic.vue +265 -0
- package/docs/examples/workflow-viewer/basic.vue +248 -0
- package/package.json +6 -2
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<j-button label="打开自定义按钮弹窗" @click="visible = true" />
|
|
4
|
+
<j-dialog-full v-model:visible="visible" title="自定义按钮" :buttons="buttons" @ok="handleOk">
|
|
5
|
+
<div style="padding: 24px">
|
|
6
|
+
<p>通过 buttons 属性可以自定义顶部操作按钮。</p>
|
|
7
|
+
<p>支持设置按钮类型、样式、图标、点击事件等。</p>
|
|
8
|
+
</div>
|
|
9
|
+
</j-dialog-full>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import { ref } from 'vue'
|
|
15
|
+
import { ElMessage } from 'element-plus'
|
|
16
|
+
|
|
17
|
+
const visible = ref(false)
|
|
18
|
+
|
|
19
|
+
const buttons = [
|
|
20
|
+
{
|
|
21
|
+
prop: 'refresh',
|
|
22
|
+
label: '刷新',
|
|
23
|
+
icon: 'material-symbols-light:refresh',
|
|
24
|
+
click: () => {
|
|
25
|
+
ElMessage.success('刷新成功')
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
prop: 'export',
|
|
30
|
+
label: '导出',
|
|
31
|
+
icon: 'material-symbols-light:download',
|
|
32
|
+
click: () => {
|
|
33
|
+
ElMessage.success('导出成功')
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
const handleOk = (showLoading: any, hideLoading: any) => {
|
|
39
|
+
showLoading('保存中...')
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
hideLoading()
|
|
42
|
+
visible.value = false
|
|
43
|
+
}, 1000)
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<j-button label="打开无按钮弹窗" @click="visible = true" />
|
|
4
|
+
<j-dialog-full v-model:visible="visible" title="无按钮弹窗" :has-btns="false">
|
|
5
|
+
<div style="padding: 24px">
|
|
6
|
+
<p>设置 has-btns 为 false 可以隐藏所有按钮。</p>
|
|
7
|
+
<p>适用于只展示内容不需要操作的场景。</p>
|
|
8
|
+
<p>可以按 ESC 键关闭弹窗,需要设置 keyboard 为 true。</p>
|
|
9
|
+
</div>
|
|
10
|
+
</j-dialog-full>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
import { ref } from 'vue'
|
|
16
|
+
|
|
17
|
+
const visible = ref(false)
|
|
18
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<j-button label="打开无表头弹窗" @click="visible = true" />
|
|
4
|
+
<j-dialog-full v-model:visible="visible" :has-header="false">
|
|
5
|
+
<div
|
|
6
|
+
style="
|
|
7
|
+
padding: 24px;
|
|
8
|
+
height: 100%;
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
"
|
|
14
|
+
>
|
|
15
|
+
<h2>无表头弹窗</h2>
|
|
16
|
+
<p>设置 has-header 为 false 可以隐藏表头区域。</p>
|
|
17
|
+
<j-button label="关闭" style="margin-top: 20px" @click="visible = false" />
|
|
18
|
+
</div>
|
|
19
|
+
</j-dialog-full>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup lang="ts">
|
|
24
|
+
import { ref } from 'vue'
|
|
25
|
+
|
|
26
|
+
const visible = ref(false)
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<j-button label="打开步骤弹窗" @click="visible = true" />
|
|
4
|
+
<j-dialog-full
|
|
5
|
+
v-model:visible="visible"
|
|
6
|
+
v-model:step-active="stepActive"
|
|
7
|
+
title="步骤弹窗"
|
|
8
|
+
:is-step="true"
|
|
9
|
+
:steps="steps"
|
|
10
|
+
:validate-steps="validateSteps"
|
|
11
|
+
@ok="handleOk"
|
|
12
|
+
>
|
|
13
|
+
<div style="padding: 24px">
|
|
14
|
+
<div v-if="stepActive === 0">
|
|
15
|
+
<h3>第一步:基本信息</h3>
|
|
16
|
+
<p>请填写基本信息</p>
|
|
17
|
+
<el-input v-model="form.name" placeholder="请输入姓名" style="margin-top: 16px" />
|
|
18
|
+
</div>
|
|
19
|
+
<div v-if="stepActive === 1">
|
|
20
|
+
<h3>第二步:详细信息</h3>
|
|
21
|
+
<p>请填写详细信息</p>
|
|
22
|
+
<el-input v-model="form.email" placeholder="请输入邮箱" style="margin-top: 16px" />
|
|
23
|
+
</div>
|
|
24
|
+
<div v-if="stepActive === 2">
|
|
25
|
+
<h3>第三步:确认信息</h3>
|
|
26
|
+
<p>姓名: {{ form.name }}</p>
|
|
27
|
+
<p>邮箱: {{ form.email }}</p>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</j-dialog-full>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script setup lang="ts">
|
|
35
|
+
import { ref, reactive } from 'vue'
|
|
36
|
+
import { ElMessage } from 'element-plus'
|
|
37
|
+
|
|
38
|
+
const visible = ref(false)
|
|
39
|
+
const stepActive = ref(0)
|
|
40
|
+
|
|
41
|
+
const steps = ['基本信息', '详细信息', '确认信息']
|
|
42
|
+
|
|
43
|
+
const form = reactive({
|
|
44
|
+
name: '',
|
|
45
|
+
email: '',
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const validateSteps = async (step: number) => {
|
|
49
|
+
if (step === 0 && !form.name) {
|
|
50
|
+
ElMessage.warning('请输入姓名')
|
|
51
|
+
return false
|
|
52
|
+
}
|
|
53
|
+
if (step === 1 && !form.email) {
|
|
54
|
+
ElMessage.warning('请输入邮箱')
|
|
55
|
+
return false
|
|
56
|
+
}
|
|
57
|
+
return true
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const handleOk = (showLoading: any, hideLoading: any) => {
|
|
61
|
+
showLoading('保存中...')
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
hideLoading()
|
|
64
|
+
visible.value = false
|
|
65
|
+
stepActive.value = 0
|
|
66
|
+
form.name = ''
|
|
67
|
+
form.email = ''
|
|
68
|
+
ElMessage.success('保存成功')
|
|
69
|
+
}, 1000)
|
|
70
|
+
}
|
|
71
|
+
</script>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="divider-demo">
|
|
3
|
+
<div class="demo-item">
|
|
4
|
+
<p>默认分隔符</p>
|
|
5
|
+
<j-divider />
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<div class="demo-item">
|
|
9
|
+
<p>带文本的分隔符</p>
|
|
10
|
+
<j-divider content="or" />
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<div class="demo-item">
|
|
14
|
+
<p>左对齐</p>
|
|
15
|
+
<j-divider content="左对齐" content-position="left" />
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="demo-item">
|
|
19
|
+
<p>右对齐</p>
|
|
20
|
+
<j-divider content="右对齐" content-position="right" />
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<div class="demo-item">
|
|
24
|
+
<p>自定义颜色和大小</p>
|
|
25
|
+
<j-divider content="自定义样式" color="#1890ff" :size="16" />
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<div class="demo-item">
|
|
29
|
+
<p>虚线样式</p>
|
|
30
|
+
<j-divider content="虚线" border-style="dashed" />
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script setup lang="ts">
|
|
36
|
+
// 示例代码无需额外逻辑
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<style scoped>
|
|
40
|
+
.divider-demo {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
gap: 24px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.demo-item p {
|
|
47
|
+
margin: 0 0 12px;
|
|
48
|
+
font-size: 14px;
|
|
49
|
+
color: var(--j-color-text-2);
|
|
50
|
+
font-weight: 500;
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<j-button label="打开抽屉" @click="visible = true" />
|
|
4
|
+
<j-drawer
|
|
5
|
+
v-model:visible="visible"
|
|
6
|
+
title="基础抽屉"
|
|
7
|
+
:width="600"
|
|
8
|
+
@ok="handleOk"
|
|
9
|
+
@close="handleClose"
|
|
10
|
+
>
|
|
11
|
+
<div style="padding: 16px">
|
|
12
|
+
<p>这是一个基础的抽屉示例。</p>
|
|
13
|
+
<p>抽屉从右侧滑出,支持自定义宽度。</p>
|
|
14
|
+
</div>
|
|
15
|
+
</j-drawer>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
import { ref } from 'vue'
|
|
21
|
+
|
|
22
|
+
const visible = ref(false)
|
|
23
|
+
|
|
24
|
+
const handleOk = (showLoading: any, hideLoading: any) => {
|
|
25
|
+
showLoading('保存中...')
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
hideLoading()
|
|
28
|
+
visible.value = false
|
|
29
|
+
}, 1000)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const handleClose = () => {
|
|
33
|
+
visible.value = false
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<j-button label="打开抽屉" @click="visible = true" />
|
|
4
|
+
<j-drawer v-model:visible="visible" title="自定义按钮" :width="600">
|
|
5
|
+
<template #btns>
|
|
6
|
+
<el-space :size="8">
|
|
7
|
+
<el-button size="small" @click="visible = false">取消</el-button>
|
|
8
|
+
<el-button size="small" type="warning" @click="handleReset">重置</el-button>
|
|
9
|
+
<el-button size="small" type="primary" @click="handleSave">保存</el-button>
|
|
10
|
+
</el-space>
|
|
11
|
+
</template>
|
|
12
|
+
<div style="padding: 16px">
|
|
13
|
+
<p>通过 btns 插槽可以自定义底部按钮。</p>
|
|
14
|
+
<p style="margin-top: 8px">这里展示了三个按钮:取消、重置和保存。</p>
|
|
15
|
+
</div>
|
|
16
|
+
</j-drawer>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
import { ref } from 'vue'
|
|
22
|
+
import { ElMessage } from 'element-plus'
|
|
23
|
+
|
|
24
|
+
const visible = ref(false)
|
|
25
|
+
|
|
26
|
+
const handleReset = () => {
|
|
27
|
+
ElMessage.info('重置成功')
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const handleSave = () => {
|
|
31
|
+
ElMessage.success('保存成功')
|
|
32
|
+
visible.value = false
|
|
33
|
+
}
|
|
34
|
+
</script>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-space>
|
|
4
|
+
<j-button label="从右侧打开(默认)" @click="openDrawer('rtl')" />
|
|
5
|
+
<j-button label="从左侧打开" @click="openDrawer('ltr')" />
|
|
6
|
+
<j-button label="从顶部打开" @click="openDrawer('ttb')" />
|
|
7
|
+
<j-button label="从底部打开" @click="openDrawer('btt')" />
|
|
8
|
+
</el-space>
|
|
9
|
+
<j-drawer
|
|
10
|
+
v-model:visible="visible"
|
|
11
|
+
:title="`${directionText}抽屉`"
|
|
12
|
+
:direction="direction"
|
|
13
|
+
:width="600"
|
|
14
|
+
>
|
|
15
|
+
<div style="padding: 16px">
|
|
16
|
+
<p>抽屉可以从四个方向打开:</p>
|
|
17
|
+
<ul style="margin-top: 8px; padding-left: 20px">
|
|
18
|
+
<li>rtl: 从右往左(默认)</li>
|
|
19
|
+
<li>ltr: 从左往右</li>
|
|
20
|
+
<li>ttb: 从上往下</li>
|
|
21
|
+
<li>btt: 从下往上</li>
|
|
22
|
+
</ul>
|
|
23
|
+
</div>
|
|
24
|
+
</j-drawer>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup lang="ts">
|
|
29
|
+
import { ref } from 'vue'
|
|
30
|
+
|
|
31
|
+
const visible = ref(false)
|
|
32
|
+
const direction = ref<'rtl' | 'ltr' | 'ttb' | 'btt'>('rtl')
|
|
33
|
+
const directionText = ref('从右侧打开的')
|
|
34
|
+
|
|
35
|
+
const directionMap = {
|
|
36
|
+
rtl: '从右侧打开的',
|
|
37
|
+
ltr: '从左侧打开的',
|
|
38
|
+
ttb: '从顶部打开的',
|
|
39
|
+
btt: '从底部打开的',
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const openDrawer = (dir: 'rtl' | 'ltr' | 'ttb' | 'btt') => {
|
|
43
|
+
direction.value = dir
|
|
44
|
+
directionText.value = directionMap[dir]
|
|
45
|
+
visible.value = true
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-space>
|
|
4
|
+
<j-button label="无遮罩层" @click="openDrawer(false)" />
|
|
5
|
+
<j-button label="可点击遮罩关闭" @click="openDrawer(true, true)" />
|
|
6
|
+
</el-space>
|
|
7
|
+
<j-drawer
|
|
8
|
+
v-model:visible="visible"
|
|
9
|
+
:title="drawerTitle"
|
|
10
|
+
:width="600"
|
|
11
|
+
:modal="modal"
|
|
12
|
+
:close-on-click-modal="closeOnClickModal"
|
|
13
|
+
>
|
|
14
|
+
<div style="padding: 16px">
|
|
15
|
+
<p v-if="!modal">设置 modal 为 false 可以取消遮罩层。</p>
|
|
16
|
+
<p v-else>设置 close-on-click-modal 为 true,点击遮罩层可以关闭抽屉。</p>
|
|
17
|
+
</div>
|
|
18
|
+
</j-drawer>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import { ref } from 'vue'
|
|
24
|
+
|
|
25
|
+
const visible = ref(false)
|
|
26
|
+
const modal = ref(true)
|
|
27
|
+
const closeOnClickModal = ref(false)
|
|
28
|
+
const drawerTitle = ref('')
|
|
29
|
+
|
|
30
|
+
const openDrawer = (hasModal: boolean, clickModal: boolean = false) => {
|
|
31
|
+
modal.value = hasModal
|
|
32
|
+
closeOnClickModal.value = clickModal
|
|
33
|
+
drawerTitle.value = hasModal ? '可点击遮罩关闭' : '无遮罩层抽屉'
|
|
34
|
+
visible.value = true
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<j-button label="打开抽屉" @click="visible = true" />
|
|
4
|
+
<j-drawer v-model:visible="visible" title="无底部按钮" :width="600" :has-btns="false">
|
|
5
|
+
<div style="padding: 16px">
|
|
6
|
+
<p>设置 has-btns 为 false 可以隐藏底部按钮。</p>
|
|
7
|
+
<p style="margin-top: 8px">这种方式适合只展示信息,不需要操作的场景。</p>
|
|
8
|
+
<div style="margin-top: 16px">
|
|
9
|
+
<el-button @click="visible = false">关闭抽屉</el-button>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</j-drawer>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
import { ref } from 'vue'
|
|
18
|
+
|
|
19
|
+
const visible = ref(false)
|
|
20
|
+
</script>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-space>
|
|
4
|
+
<j-button label="小尺寸(400px)" @click="openDrawer(400)" />
|
|
5
|
+
<j-button label="中尺寸(600px)" @click="openDrawer(600)" />
|
|
6
|
+
<j-button label="大尺寸(800px)" @click="openDrawer(800)" />
|
|
7
|
+
<j-button label="百分比(50%)" @click="openDrawer('50%')" />
|
|
8
|
+
</el-space>
|
|
9
|
+
<j-drawer v-model:visible="visible" :title="`宽度: ${currentSize}`" :size="currentSize">
|
|
10
|
+
<div style="padding: 16px">
|
|
11
|
+
<p>抽屉的尺寸可以通过 size 或 width 属性自定义。</p>
|
|
12
|
+
<p style="margin-top: 8px">当前尺寸: {{ currentSize }}</p>
|
|
13
|
+
</div>
|
|
14
|
+
</j-drawer>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
import { ref } from 'vue'
|
|
20
|
+
|
|
21
|
+
const visible = ref(false)
|
|
22
|
+
const currentSize = ref<string | number>('600px')
|
|
23
|
+
|
|
24
|
+
const openDrawer = (size: string | number) => {
|
|
25
|
+
currentSize.value = typeof size === 'number' ? `${size}px` : size
|
|
26
|
+
visible.value = true
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<j-button label="打开动态组件" @click="openLayer" />
|
|
4
|
+
<j-dynamic-layer ref="layerRef" />
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import { ref, h } from 'vue'
|
|
10
|
+
|
|
11
|
+
const layerRef = ref()
|
|
12
|
+
|
|
13
|
+
// 动态组件示例
|
|
14
|
+
const DemoComponent = {
|
|
15
|
+
setup() {
|
|
16
|
+
return () =>
|
|
17
|
+
h('div', { style: 'padding: 16px' }, [
|
|
18
|
+
h('p', '这是一个动态加载的组件'),
|
|
19
|
+
h('p', '可以是任何 Vue 组件'),
|
|
20
|
+
])
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const openLayer = () => {
|
|
25
|
+
layerRef.value.open({
|
|
26
|
+
title: '动态组件示例',
|
|
27
|
+
name: DemoComponent,
|
|
28
|
+
type: 'modal',
|
|
29
|
+
width: 600,
|
|
30
|
+
height: 400,
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<j-button label="自定义按钮" @click="openLayer" />
|
|
4
|
+
<j-dynamic-layer ref="layerRef" />
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import { ref, h } from 'vue'
|
|
10
|
+
|
|
11
|
+
const layerRef = ref()
|
|
12
|
+
|
|
13
|
+
const CustomComponent = {
|
|
14
|
+
setup(props: any, { expose }: any) {
|
|
15
|
+
const getConfig = () => {
|
|
16
|
+
return {
|
|
17
|
+
buttons: [
|
|
18
|
+
{
|
|
19
|
+
label: '自定义操作',
|
|
20
|
+
type: 'primary',
|
|
21
|
+
onClick: () => {
|
|
22
|
+
alert('执行自定义操作')
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
expose({ getConfig })
|
|
30
|
+
|
|
31
|
+
return () => h('div', { style: 'padding: 16px' }, [h('p', '这个弹层有自定义按钮')])
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const openLayer = () => {
|
|
36
|
+
layerRef.value.open({
|
|
37
|
+
title: '自定义按钮示例',
|
|
38
|
+
name: CustomComponent,
|
|
39
|
+
type: 'modal',
|
|
40
|
+
hasSaveBtn: false,
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<j-button label="打开表单组件" @click="openFormLayer" />
|
|
4
|
+
<j-dynamic-layer ref="layerRef" />
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import { ref, h } from 'vue'
|
|
10
|
+
|
|
11
|
+
const layerRef = ref()
|
|
12
|
+
|
|
13
|
+
// 表单组件示例
|
|
14
|
+
const FormComponent = {
|
|
15
|
+
setup(props: any, { expose }: any) {
|
|
16
|
+
const formData = ref({
|
|
17
|
+
name: '',
|
|
18
|
+
email: '',
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
// 提供给外层调用的方法
|
|
22
|
+
const open = (param: any) => {
|
|
23
|
+
console.log('接收参数:', param)
|
|
24
|
+
return Promise.resolve()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const ok = () => {
|
|
28
|
+
if (!formData.value.name) {
|
|
29
|
+
alert('请输入姓名')
|
|
30
|
+
return Promise.resolve(false)
|
|
31
|
+
}
|
|
32
|
+
console.log('提交数据:', formData.value)
|
|
33
|
+
return Promise.resolve(true)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
expose({ open, ok })
|
|
37
|
+
|
|
38
|
+
return () =>
|
|
39
|
+
h('div', { style: 'padding: 16px' }, [
|
|
40
|
+
h('div', { style: 'margin-bottom: 16px' }, [
|
|
41
|
+
h('label', '姓名: '),
|
|
42
|
+
h('input', {
|
|
43
|
+
value: formData.value.name,
|
|
44
|
+
onInput: (e: any) => (formData.value.name = e.target.value),
|
|
45
|
+
style: 'margin-left: 8px; padding: 4px 8px',
|
|
46
|
+
}),
|
|
47
|
+
]),
|
|
48
|
+
h('div', [
|
|
49
|
+
h('label', '邮箱: '),
|
|
50
|
+
h('input', {
|
|
51
|
+
value: formData.value.email,
|
|
52
|
+
onInput: (e: any) => (formData.value.email = e.target.value),
|
|
53
|
+
style: 'margin-left: 8px; padding: 4px 8px',
|
|
54
|
+
}),
|
|
55
|
+
]),
|
|
56
|
+
])
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const openFormLayer = () => {
|
|
61
|
+
layerRef.value.open({
|
|
62
|
+
title: '表单示例',
|
|
63
|
+
name: FormComponent,
|
|
64
|
+
type: 'modal',
|
|
65
|
+
width: 500,
|
|
66
|
+
height: 300,
|
|
67
|
+
param: { id: 123 },
|
|
68
|
+
afterOk: (data: any) => {
|
|
69
|
+
console.log('保存成功回调:', data)
|
|
70
|
+
},
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
</script>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<j-button label="打开步骤弹窗" @click="openStepLayer" />
|
|
4
|
+
<j-dynamic-layer ref="layerRef" />
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import { ref, h } from 'vue'
|
|
10
|
+
|
|
11
|
+
const layerRef = ref()
|
|
12
|
+
const currentStep = ref(0)
|
|
13
|
+
|
|
14
|
+
const StepComponent = {
|
|
15
|
+
setup(props: any, { expose }: any) {
|
|
16
|
+
const getConfig = () => {
|
|
17
|
+
return {
|
|
18
|
+
isStep: true,
|
|
19
|
+
steps: ['基本信息', '详细信息', '确认提交'],
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const validateSteps = (stepActive: number) => {
|
|
24
|
+
console.log('校验步骤:', stepActive)
|
|
25
|
+
if (stepActive === 0 && !confirm('是否继续下一步?')) {
|
|
26
|
+
return Promise.resolve(false)
|
|
27
|
+
}
|
|
28
|
+
currentStep.value = stepActive
|
|
29
|
+
return Promise.resolve(true)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
expose({ getConfig, validateSteps })
|
|
33
|
+
|
|
34
|
+
return () =>
|
|
35
|
+
h('div', { style: 'padding: 16px' }, [
|
|
36
|
+
h('h3', `当前步骤: ${currentStep.value + 1}`),
|
|
37
|
+
h('p', '步骤条示例'),
|
|
38
|
+
])
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const openStepLayer = () => {
|
|
43
|
+
currentStep.value = 0
|
|
44
|
+
layerRef.value.open({
|
|
45
|
+
title: '步骤弹窗',
|
|
46
|
+
name: StepComponent,
|
|
47
|
+
type: 'modal',
|
|
48
|
+
width: 700,
|
|
49
|
+
height: 400,
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
</script>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<j-button label="打开抽屉" style="margin-right: 8px" @click="openDrawer" />
|
|
4
|
+
<j-button label="打开全屏" @click="openFull" />
|
|
5
|
+
<j-dynamic-layer ref="layerRef" />
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
import { ref, h } from 'vue'
|
|
11
|
+
|
|
12
|
+
const layerRef = ref()
|
|
13
|
+
|
|
14
|
+
const ContentComponent = {
|
|
15
|
+
setup() {
|
|
16
|
+
return () =>
|
|
17
|
+
h('div', { style: 'padding: 16px' }, [
|
|
18
|
+
h('h3', '不同类型的弹层'),
|
|
19
|
+
h('p', '支持 modal、drawer、full 三种类型'),
|
|
20
|
+
])
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const openDrawer = () => {
|
|
25
|
+
layerRef.value.open({
|
|
26
|
+
title: '抽屉模式',
|
|
27
|
+
name: ContentComponent,
|
|
28
|
+
type: 'drawer',
|
|
29
|
+
width: 600,
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const openFull = () => {
|
|
34
|
+
layerRef.value.open({
|
|
35
|
+
title: '全屏模式',
|
|
36
|
+
name: ContentComponent,
|
|
37
|
+
type: 'full',
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
</script>
|