@a2simcode/ui 0.0.126 → 0.0.128
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/dist/components/decorated-title/index.d.ts +46 -0
- package/dist/components/decorated-title/src/decorated-title.vue.d.ts +62 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/components/slider-captcha/index.d.ts +5 -5
- package/dist/components/slider-captcha/src/slider-captcha-content.vue.d.ts +1 -1
- package/dist/components/slider-captcha/src/slider-captcha.vue.d.ts +3 -3
- package/dist/simcode-ui.es.js +3157 -2989
- package/dist/simcode-ui.umd.js +2 -2
- package/dist/stats.html +1 -1
- package/dist/ui.css +1 -1
- package/docs/components/decorated-title.md +24 -0
- package/docs/components/form.md +16 -1
- package/docs/components/meta/decorated-title.ts +74 -0
- package/docs/examples/decorated-title/basic.vue +31 -0
- package/docs/examples/form/basic.vue +37 -0
- package/docs/examples/form/init.vue +76 -0
- package/package.json +1 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<j-form ref="formRef" :config="formConfig" />
|
|
4
|
+
<div style="margin-top: 16px; padding-left: 100px">
|
|
5
|
+
<j-button type="primary" label="init 精简表单" @click="handleInitSimple"></j-button>
|
|
6
|
+
<j-button style="margin-left: 8px" label="init 完整表单" @click="handleInitFull"></j-button>
|
|
7
|
+
<j-button style="margin-left: 8px" label="获取数据" @click="handleGetFormData"></j-button>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup>
|
|
13
|
+
import { ref, reactive } from 'vue'
|
|
14
|
+
|
|
15
|
+
const formRef = ref()
|
|
16
|
+
|
|
17
|
+
const formConfig = reactive({
|
|
18
|
+
labelWidth: 100,
|
|
19
|
+
labelPosition: 'right',
|
|
20
|
+
size: 'default',
|
|
21
|
+
gutter: 16,
|
|
22
|
+
span: 24,
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const simpleSchema = [
|
|
26
|
+
{
|
|
27
|
+
type: 'j-input',
|
|
28
|
+
config: {
|
|
29
|
+
label: '用户名',
|
|
30
|
+
field: 'username',
|
|
31
|
+
placeholder: '请输入用户名',
|
|
32
|
+
rule: [{ required: true, message: '请输入用户名' }],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: 'j-number',
|
|
37
|
+
config: {
|
|
38
|
+
label: '年龄',
|
|
39
|
+
field: 'age',
|
|
40
|
+
placeholder: '请输入年龄',
|
|
41
|
+
min: 0,
|
|
42
|
+
max: 150,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
const fullSchema = [
|
|
48
|
+
...simpleSchema,
|
|
49
|
+
{
|
|
50
|
+
type: 'j-select',
|
|
51
|
+
config: {
|
|
52
|
+
label: '状态',
|
|
53
|
+
field: 'status',
|
|
54
|
+
placeholder: '请选择',
|
|
55
|
+
options: [
|
|
56
|
+
{ label: '启用', value: 1 },
|
|
57
|
+
{ label: '停用', value: 0 },
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
const schema = fullSchema
|
|
64
|
+
|
|
65
|
+
const handleInitSimple = async () => {
|
|
66
|
+
await formRef.value.init(simpleSchema, { username: '张三', age: 18 })
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const handleInitFull = async () => {
|
|
70
|
+
await formRef.value.init(fullSchema, { username: '李四', age: 28, status: 1 })
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const handleGetFormData = () => {
|
|
74
|
+
console.log(formRef.value.getFormData(), 'getFormData')
|
|
75
|
+
}
|
|
76
|
+
</script>
|