Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[V3]新增select与checkbox的原生name属性设置 #2068

Open
wants to merge 2 commits into
base: v3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions examples/views/checkbox/Checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<p class="tip">复选框、复选组</p>

<p>
<vxe-checkbox v-model="value1" content="默认尺寸"></vxe-checkbox>
<vxe-checkbox v-model="value2" size="medium" content="中等尺寸"></vxe-checkbox>
<vxe-checkbox v-model="value3" size="small" content="小型尺寸"></vxe-checkbox>
<vxe-checkbox v-model="value4" size="mini" content="超小尺寸"></vxe-checkbox>
<vxe-checkbox v-model="value5" content="默认尺寸" indeterminate></vxe-checkbox>
<vxe-checkbox v-model="value6" size="medium" content="中等尺寸" indeterminate></vxe-checkbox>
<vxe-checkbox v-model="value7" size="small" content="小型尺寸" indeterminate></vxe-checkbox>
<vxe-checkbox v-model="value8" size="mini" content="超小尺寸" indeterminate></vxe-checkbox>
<vxe-checkbox v-model="value1" name="value2" content="默认尺寸"></vxe-checkbox>
<vxe-checkbox v-model="value2" name="value1" size="medium" content="中等尺寸"></vxe-checkbox>
<vxe-checkbox v-model="value3" name="value1" size="small" content="小型尺寸"></vxe-checkbox>
<vxe-checkbox v-model="value4" name="value1" size="mini" content="超小尺寸"></vxe-checkbox>
<vxe-checkbox v-model="value5" name="value1" content="默认尺寸" indeterminate></vxe-checkbox>
<vxe-checkbox v-model="value6" name="value1" size="medium" content="中等尺寸" indeterminate></vxe-checkbox>
<vxe-checkbox v-model="value7" name="value1" size="small" content="小型尺寸" indeterminate></vxe-checkbox>
<vxe-checkbox v-model="value8" name="value1" size="mini" content="超小尺寸" indeterminate></vxe-checkbox>
</p>

<p>
Expand Down
8 changes: 4 additions & 4 deletions examples/views/select/Select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
<p class="tip">下拉框,查看 <router-link class="link" :to="{name: 'VXEAPI', params: {name: 'select'}}">API</router-link>,可以通过 <router-link class="link" :to="{name: 'StartGlobal'}">setup</router-link> 设置全局参数</p>

<p>
<vxe-select v-model="value10" placeholder="默认尺寸">
<vxe-select v-model="value10" name="value10" placeholder="默认尺寸">
<vxe-option v-for="num in 15" :key="num" :value="num" :label="`选项${num}`"></vxe-option>
</vxe-select>
<vxe-select v-model="value11" placeholder="中等尺寸" size="medium">
<vxe-select v-model="value11" name="value11" placeholder="中等尺寸" size="medium">
<vxe-option v-for="num in 10" :key="num" :value="num" :label="`选项${num}`"></vxe-option>
</vxe-select>
<vxe-select v-model="value12" placeholder="小型尺寸" size="small">
<vxe-select v-model="value12" name="value12" placeholder="小型尺寸" size="small">
<vxe-option v-for="num in 10" :key="num" :value="num" :label="`选项${num}`"></vxe-option>
</vxe-select>
<vxe-select v-model="value13" placeholder="超小尺寸" size="mini">
<vxe-select v-model="value13" name="value13" placeholder="超小尺寸" size="mini">
<vxe-option v-for="num in 10" :key="num" :value="num" :label="`选项${num}`"></vxe-option>
</vxe-select>
</p>
Expand Down
4 changes: 3 additions & 1 deletion packages/checkbox/src/checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default {
props: {
value: [String, Number, Boolean],
label: [String, Number],
name: String,
indeterminate: Boolean,
title: [String, Number],
content: [String, Number],
Expand Down Expand Up @@ -68,7 +69,8 @@ export default {
class: 'vxe-checkbox--input',
attrs: {
type: 'checkbox',
disabled: isDisabled
disabled: isDisabled,
name: this.name
},
domProps: {
checked: isChecked
Expand Down
2 changes: 2 additions & 0 deletions packages/select/src/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ export default {
props: {
value: null,
clearable: Boolean,
name: String,
placeholder: String,
loading: Boolean,
disabled: Boolean,
Expand Down Expand Up @@ -429,6 +430,7 @@ export default {
props: {
clearable: this.clearable,
placeholder: this.placeholder,
name: this.name,
readonly: true,
disabled: disabled,
type: 'text',
Expand Down
4 changes: 4 additions & 0 deletions types/checkbox.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ export declare class Checkbox extends VXETableComponent {
* 绑定值
*/
value?: boolean;
/**
* 原生 name 属性
*/
name?: string;
/**
* 只对 checkbox-group 有效,值
*/
Expand Down
4 changes: 4 additions & 0 deletions types/select.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export declare class Select extends VXETableComponent {
* 当有值时,是否在右侧显示清除按钮
*/
clearable?: boolean;
/**
* 原生 name 属性
*/
name?: string;
/**
* 空值显示的占位符
*/
Expand Down