Browse Source

select增加默认展示项

master
zq 2 days ago
parent
commit
8b1168eba8
  1. 19
      src/components/GuipSelect.vue
  2. 3
      src/views/elementGroups.vue

19
src/components/GuipSelect.vue

@ -30,6 +30,11 @@ export default {
type: String,
default: 'label'
},
//
extraItem: {
type: Object,
default: null
},
styleObject: Object,
disabled: Boolean,
required: Boolean,
@ -55,7 +60,19 @@ export default {
computed: {
// options
processedOptions() {
return this.options || []
let options = this.options || [];
// extraItemoptions
if (this.extraItem && Object.keys(this.extraItem).length > 0) {
return [
{
[this.labelKey]: this.extraItem.label || '',
[this.valueKey]: this.extraItem.value || '',
disabled: this.extraItem.disabled || false
},
...options
];
}
return options;
}
},
watch: {

3
src/views/elementGroups.vue

@ -76,8 +76,9 @@
</div>
<div class="ele-item">
<label for="">下拉框</label>
<!-- :extraItem="{label:'全部',value:'99999'}" 传入必须是 labelvalue 组件内会自动改为自定义的 labelKeyvalueKey-->
<GuipSelect width="600px" v-model="form.card" clearable label="卡片" :default-value="form.card"
prop="card" :options="options" valueKey="id1" labelKey="id2" />
prop="card" :options="options" valueKey="id1" labelKey="id2" :extraItem="{label:'全部',value:'99999'}"/>
</div>
<div>
<h3 for="">表格(表头自定义自定义渲染固定列)</h3>

Loading…
Cancel
Save