@a2simcode/ui 0.0.127 → 0.0.129
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/index.d.ts +2 -1
- package/dist/components/input-decorated-title/index.d.ts +54 -0
- package/dist/components/input-decorated-title/src/input-decorated-title.vue.d.ts +43 -0
- package/dist/simcode-ui.es.js +1482 -1403
- package/dist/simcode-ui.umd.js +2 -2
- package/dist/stats.html +1 -1
- package/dist/ui.css +1 -1
- package/docs/components/form.md +16 -1
- package/docs/components/input-decorated-title.md +24 -0
- package/docs/components/meta/form-item.ts +50 -50
- package/docs/components/meta/input-decorated-title.ts +38 -0
- package/docs/examples/form/basic.vue +37 -0
- package/docs/examples/form/init.vue +76 -0
- package/docs/examples/input-decorated-title/basic.vue +23 -0
- package/package.json +1 -1
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
<j-button type="primary" label="提交" @click="handleSubmit"></j-button>
|
|
6
6
|
<j-button style="margin-left: 8px" label="重置" @click="handleReset"></j-button>
|
|
7
7
|
<j-button style="margin-left: 8px" label="获取数据" @click="handleGetFormData"></j-button>
|
|
8
|
+
<j-button
|
|
9
|
+
style="margin-left: 8px"
|
|
10
|
+
label="init 重新初始化"
|
|
11
|
+
@click="handleInitWithSchema"
|
|
12
|
+
></j-button>
|
|
13
|
+
<j-button style="margin-left: 8px" label="init 恢复" @click="handleInitReset"></j-button>
|
|
8
14
|
</div>
|
|
9
15
|
</div>
|
|
10
16
|
</template>
|
|
@@ -25,6 +31,37 @@ const formConfig = reactive({
|
|
|
25
31
|
const handleGetFormData = () => {
|
|
26
32
|
console.log(formRef.value.getFormData(), 'getFormData')
|
|
27
33
|
}
|
|
34
|
+
|
|
35
|
+
const initSchema = [
|
|
36
|
+
{
|
|
37
|
+
type: 'j-input',
|
|
38
|
+
config: {
|
|
39
|
+
label: '用户名',
|
|
40
|
+
field: 'username',
|
|
41
|
+
placeholder: '请输入用户名',
|
|
42
|
+
rule: [{ required: true, message: '请输入用户名' }],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
type: 'j-number',
|
|
47
|
+
config: {
|
|
48
|
+
label: '年龄',
|
|
49
|
+
field: 'age',
|
|
50
|
+
placeholder: '请输入年龄',
|
|
51
|
+
min: 0,
|
|
52
|
+
max: 150,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
const handleInitWithSchema = async () => {
|
|
58
|
+
await formRef.value.init(initSchema, { username: '张三', age: 18 })
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const handleInitReset = async () => {
|
|
62
|
+
await formRef.value.init(schema)
|
|
63
|
+
}
|
|
64
|
+
|
|
28
65
|
const schema = [
|
|
29
66
|
{
|
|
30
67
|
type: 'el-segmented',
|
|
@@ -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>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<h3>基本使用</h3>
|
|
4
|
+
<j-input-decorated-title v-model="titleType1" />
|
|
5
|
+
<p>当前选中的 titleType: {{ titleType1 }}</p>
|
|
6
|
+
|
|
7
|
+
<h3>自定义背景颜色</h3>
|
|
8
|
+
<j-input-decorated-title v-model="titleType2" background-color="#409eff" />
|
|
9
|
+
<p>当前选中的 titleType: {{ titleType2 }}</p>
|
|
10
|
+
|
|
11
|
+
<h3>自定义标题颜色和字体粗细</h3>
|
|
12
|
+
<j-input-decorated-title v-model="titleType3" color="#f56c6c" weight="bold" />
|
|
13
|
+
<p>当前选中的 titleType: {{ titleType3 }}</p>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
import { ref } from 'vue'
|
|
19
|
+
|
|
20
|
+
const titleType1 = ref('title1')
|
|
21
|
+
const titleType2 = ref('title2')
|
|
22
|
+
const titleType3 = ref('title3')
|
|
23
|
+
</script>
|