This commit is contained in:
parent
29d02046e9
commit
d34f05a3ca
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="sc-icon-select">
|
<div class="sc-icon-select">
|
||||||
<el-input v-model="defaultValue" :prefix-icon="defaultValue||'none'" :placeholder="placeholder" :clearable="clearable" :disabled="disabled">
|
<el-input v-model="defaultValue" :prefix-icon="defaultValue||'none'" :placeholder="placeholder" :clearable="clearable" :disabled="disabled" @clear="onClear" @change="onChange">
|
||||||
<template #append><el-button icon="el-icon-more" @click="open"></el-button></template>
|
<template #append><el-button icon="el-icon-more" @click="open"></el-button></template>
|
||||||
</el-input>
|
</el-input>
|
||||||
<el-dialog title="图标选择器" v-model="dialogVisible" :width="780" destroy-on-close>
|
<el-dialog title="图标选择器" v-model="dialogVisible" :width="780" destroy-on-close>
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
props: {
|
props: {
|
||||||
modelValue: { type: String, default: "" },
|
modelValue: { type: String, default: "" },
|
||||||
placeholder: { type: String, default: "请输入或者选择图标" },
|
placeholder: { type: String, default: "请输入或者选择图标" },
|
||||||
clearable: { type: Boolean, default: false },
|
clearable: { type: Boolean, default: true },
|
||||||
disabled: { type: Boolean, default: false },
|
disabled: { type: Boolean, default: false },
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
@ -75,12 +75,21 @@
|
||||||
this.dialogVisible = true
|
this.dialogVisible = true
|
||||||
},
|
},
|
||||||
selectIcon(e){
|
selectIcon(e){
|
||||||
|
console.log(111,e)
|
||||||
if(e.target.tagName != 'I'){
|
if(e.target.tagName != 'I'){
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
this.defaultValue = e.target.className
|
this.defaultValue = e.target.className
|
||||||
this.dialogVisible = false
|
this.dialogVisible = false
|
||||||
this.$emit('update:modelValue', this.defaultValue);
|
this.$emit('update:modelValue', this.defaultValue);
|
||||||
|
},
|
||||||
|
onClear() {
|
||||||
|
this.$emit('update:modelValue', this.defaultValue);
|
||||||
|
},
|
||||||
|
onChange() {
|
||||||
|
if(this.defaultValue == ''){
|
||||||
|
this.$emit('update:modelValue', this.defaultValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue