x-php-Admin/copy backup/vab/iconselect.vue
2023-07-30 10:16:32 +08:00

67 lines
1.5 KiB
Vue

<!--
* @Descripttion: 图标选择器组件演示文件
-->
<template>
<el-main>
<el-alert title="支持扩展的图标选择器,除了默认的图标组还可以在 @/config/iconSelect 中定义更多的图标组" type="success" style="margin-bottom:20px;"></el-alert>
<el-card shadow="never">
<el-form ref="ruleForm" :model="form" :rules="rules" label-width="100px">
<el-form-item label="图标" prop="icon">
<x-icon-select v-model="form.icon" :disabled="disabled"></x-icon-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm">保存</el-button>
<el-button @click="resetForm">重置</el-button>
<el-button @click="setdisabled">{{disabled?'移除禁用':'设为禁用'}}</el-button>
</el-form-item>
</el-form>
</el-card>
</el-main>
</template>
<script>
import xIconSelect from '@/components/xIconSelect'
export default {
name: 'iconSelect',
components: {
xIconSelect
},
data() {
return {
form: {
icon: 'el-icon-apple'
},
rules: {
icon: [
{required: true, message: '请选择图标', trigger: 'change'}
]
},
disabled: false
}
},
methods: {
submitForm(){
this.$refs.ruleForm.validate((valid) => {
if (valid) {
alert('请看控制台输出');
console.log(this.form);
}else{
return false;
}
})
},
resetForm(){
this.$refs.ruleForm.resetFields();
},
setdisabled(){
this.disabled = !this.disabled
}
}
}
</script>
<style>
</style>