Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
data-table
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2022-09-08 13:39:41 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
828f3ac0a4f30af7f7af414838d49a87c7e8ec26
828f3ac0
1 parent
68f12d25
✨ feat: 多项选择控件新增排列方向属性和最大可选数属性
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
40 deletions
src/components/CheckboxField/index.vue
src/views/index.vue
src/components/CheckboxField/index.vue
View file @
828f3ac
<!--
* @Date: 2022-08-30 11:34:19
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-09-0
7 16:06:06
* @LastEditTime: 2022-09-0
8 13:35:49
* @FilePath: /data-table/src/components/CheckboxField/index.vue
* @Description: 文件描述
-->
<template>
<div class="checkbox-field-page">
<div class="label">{{ item.label }}<span v-if="item.required"> *</span></div>
<van-field :name="item.key" :border="false">
<div class="label">
{{ item.label }}
<span v-if="item.required" style="color: red;"> *</span>
<span v-if="item.component_props.max" style="color: gray;">(最多可选数: {{ item.component_props.max }})</span>
</div>
<van-field :name=" item.key" :border="false">
<template #input>
<van-checkbox-group v-model="item.value">
<van-checkbox-group v-model="item.value" :direction="item.component_props.direction"
:max="item.component_props.max">
<van-checkbox v-for="x in item.options" :key="index" :name="x.key" icon-size="1rem" shape="square"
style="margin-bottom: 0.25rem;">{{ x.value }}</van-checkbox>
</van-checkbox-group>
...
...
@@ -31,9 +36,6 @@ const props = defineProps({
padding: 1rem 1rem 0 1rem;
font-size: 0.9rem;
font-weight: bold;
span {
color: red;
}
}
}
</style>
...
...
src/views/index.vue
View file @
828f3ac
<!--
* @Date: 2022-07-18 10:22:22
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-09-08 1
1:35:17
* @LastEditTime: 2022-09-08 1
3:38:52
* @FilePath: /data-table/src/views/index.vue
* @Description: 首页
-->
...
...
@@ -46,17 +46,17 @@ onMounted(() => {
// },
// required: true,
// },
{
key: 'username',
value: 'test',
label: '用户名',
placeholder: '请输入用户名',
component: '',
component_props: {
name: 'text'
},
required: true,
},
//
{
//
key: 'username',
//
value: 'test',
//
label: '用户名',
//
placeholder: '请输入用户名',
//
component: '',
//
component_props: {
//
name: 'text'
//
},
//
required: true,
//
},
// {
// key: 'email',
// value: '',
...
...
@@ -77,33 +77,35 @@ onMounted(() => {
// component_props: {
// name: 'number'
// },
// required:
fals
e,
// },
{
key: 'gender',
value: '',
label: '性别',
placeholder: '',
component: '',
component_props: {
name: 'radio',
direction: 'horizontal'
},
options: [{
key: '男',
value: '男'
}, {
key: '女',
value: '女'
}]
},
// required:
tru
e,
// },
//
{
//
key: 'gender',
//
value: '',
//
label: '性别',
//
placeholder: '',
//
component: '',
//
component_props: {
//
name: 'radio',
//
direction: 'horizontal'
//
},
//
options: [{
//
key: '男',
//
value: '男'
//
}, {
//
key: '女',
//
value: '女'
//
}]
//
},
// {
// key: 'hobby',
// value: [],
// label: '兴趣爱好',
// component: '',
// component_props: {
// name: 'checkbox'
// name: 'checkbox',
// direction: 'horizontal',
// max: '3'
// },
// options: [{
// key: '足球',
...
...
@@ -111,6 +113,12 @@ onMounted(() => {
// }, {
// key: '篮球',
// value: '篮球'
// }, {
// key: '羽毛球',
// value: '羽毛球'
// }, {
// key: '乒乓球',
// value: '乒乓球'
// }]
// },
// {
...
...
Please
register
or
login
to post a comment