Compare commits

..

2 Commits

Author SHA1 Message Date
ln1778 57ef27b43d 222 2024-09-13 11:23:27 +08:00
ln1778 8565ddb5a3 44 2024-09-13 11:21:38 +08:00
2 changed files with 10 additions and 7 deletions

View File

@ -44,7 +44,7 @@ export default {
data() { data() {
return { return {
values: [null, []], values: [null, []],
swidth:90, swidth:100,
inputValue:"", inputValue:"",
selectvalue:"", selectvalue:"",
imeipopover:false, imeipopover:false,
@ -66,7 +66,9 @@ export default {
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;
} }else{
this.swidth=100;
}
}, },
immediate: true, immediate: true,

View File

@ -7,7 +7,7 @@
:value="value&&value[0]" :value="value&&value[0]"
@change="onSelect" @change="onSelect"
class="ag_select_group" class="ag_select_group"
:style="{ width: `${swidth}px` }" :style="{ width: `${swidth+20}px` }"
> >
</ag-select> </ag-select>
<ag-input <ag-input
@ -132,12 +132,13 @@
throw new Error("请传入数组"); throw new Error("请传入数组");
} }
let newselectValue=newVal[0]; let newselectValue=newVal[0];
const find=this.$attrs.options&&this.$attrs.options.find((f)=>f.value==newselectValue); const find=newselectValue&&newselectValue!=""&&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;
}else{
this.swidth=120;
} }
}, },
immediate: true, immediate: true,
}, },
@ -151,13 +152,13 @@
methods: { methods: {
onSelect(value){ onSelect(value){
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){
this.$emit("change", [this.value[0] ||"",val]); this.$emit("change", [this.value[0]||"",val]);
} }
}, },
getStringWidth(text) { getStringWidth(text) {