liunan #10

Merged
liunan merged 47 commits from liunan into master 2024-09-13 14:43:34 +08:00
3 changed files with 214 additions and 225 deletions
Showing only changes of commit 3bbf8a51dc - Show all commits

View File

@ -1,6 +1,6 @@
{ {
"name": "ag-element-ui", "name": "ag-element-ui",
"version": "0.1.11", "version": "0.1.12",
"main": "packages/index.js", "main": "packages/index.js",
"scripts": { "scripts": {
"dev": "vue-cli-service serve", "dev": "vue-cli-service serve",

View File

@ -3,7 +3,8 @@
<ag-select <ag-select
v-bind="$attrs" v-bind="$attrs"
v-on="listeners" v-on="listeners"
:value="values&&values[0]" :options="$attrs.options||[]"
:value="value&&value[0]"
@change="onSelect" @change="onSelect"
class="ag_select_group" class="ag_select_group"
:style="{ width: `${swidth}px` }" :style="{ width: `${swidth}px` }"
@ -105,12 +106,6 @@ export default {
return [null, '']; return [null, ''];
}, },
}, },
options: {
type: Array,
default: () => {
return [];
},
},
showExtra: { showExtra: {
type: Boolean, type: Boolean,
default: false, default: false,
@ -137,7 +132,7 @@ export default {
throw new Error("请传入数组"); throw new Error("请传入数组");
} }
let newselectValue=newVal[0]; let newselectValue=newVal[0];
const find=this.options.find((f)=>f.value==newselectValue); const find=this.$attrs.options&&this.$attrs.options.find((f)=>f.value==newselectValue);
if(find){ if(find){
let fontwidth=this.getStringWidth(find.label); let fontwidth=this.getStringWidth(find.label);
this.swidth=fontwidth>165?165:fontwidth; this.swidth=fontwidth>165?165:fontwidth;

View File

@ -3,7 +3,8 @@
<ag-select <ag-select
v-bind="$attrs" v-bind="$attrs"
v-on="listeners" v-on="listeners"
:value="values&&values[0]" :options="$attrs.options||[]"
:value="value&&value[0]"
@change="onSelect" @change="onSelect"
class="ag_select_group" class="ag_select_group"
:style="{ width: `${swidth}px` }" :style="{ width: `${swidth}px` }"
@ -39,12 +40,6 @@
return [null, []]; return [null, []];
}, },
}, },
options: {
type: Array,
default: () => {
return [];
},
},
}, },
data() { data() {
return { return {
@ -67,7 +62,7 @@
throw new Error("请传入数组"); throw new Error("请传入数组");
} }
let newselectValue=newVal[0]; let newselectValue=newVal[0];
const find=this.options.find((f)=>f.value==newselectValue); const find=this.$attrs.options&&this.$attrs.options.find((f)=>f.value==newselectValue);
if(find){ if(find){
let fontwidth=this.getStringWidth(find.label); let fontwidth=this.getStringWidth(find.label);
this.swidth=fontwidth>165?165:fontwidth; this.swidth=fontwidth>165?165:fontwidth;
@ -88,7 +83,6 @@
if(this.$listeners.change){ if(this.$listeners.change){
this.$emit("change", [value, this.value[1]||[]]); this.$emit("change", [value, this.value[1]||[]]);
} }
}, },
onInputChange(val){ onInputChange(val){
if(this.$listeners.change){ if(this.$listeners.change){