feat: 图标选择器
This commit is contained in:
parent
9798965f6a
commit
9d29270cc5
@ -57,7 +57,7 @@ const onIcon = (iconName: string) => {
|
||||
emit("select", iconName);
|
||||
};
|
||||
|
||||
const visible = ref(false);
|
||||
const visible = ref<boolean>(false);
|
||||
const open = () => {
|
||||
searchName.value = "";
|
||||
visible.value = true;
|
||||
|
||||
@ -28,7 +28,7 @@ export default {
|
||||
["draggable"]: "draggable",
|
||||
["editor"]: "editor",
|
||||
["newbie"]: "newbie",
|
||||
["icon-component"]: "icon component",
|
||||
["icon-selector"]: "icon selector",
|
||||
["user-center"]: "user center",
|
||||
["markdown"]: "Markdown",
|
||||
["custom-instruction"]: "custom instruction",
|
||||
|
||||
@ -28,7 +28,7 @@ export default {
|
||||
["draggable"]: "拖拽",
|
||||
["editor"]: "富文本",
|
||||
["newbie"]: "新手指引",
|
||||
["icon-component"]: "icon组件",
|
||||
["icon-selector"]: "图标选择器",
|
||||
["user-center"]: "用户中心",
|
||||
["markdown"]: "Markdown",
|
||||
["custom-instruction"]: "自定义指令",
|
||||
|
||||
@ -389,11 +389,11 @@ export const dynamicRoutes: RouteRecordRaw[] = [
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/common-component/icon-component",
|
||||
name: "icon-component",
|
||||
component: () => import("@/views/common-component/icon-component/icon-component.vue"),
|
||||
path: "/common-component/icon-selector",
|
||||
name: "icon-selector",
|
||||
component: () => import("@/views/common-component/icon-selector/icon-selector.vue"),
|
||||
meta: {
|
||||
title: "icon-component",
|
||||
title: "icon-selector",
|
||||
hide: false,
|
||||
disable: false,
|
||||
keepAlive: true,
|
||||
|
||||
@ -2,17 +2,13 @@
|
||||
<div class="snow-page">
|
||||
<div class="snow-inner-page">
|
||||
<div class="title">图标选择器</div>
|
||||
<a-input
|
||||
:style="{ width: '400px' }"
|
||||
placeholder="请选择图标"
|
||||
allow-clear
|
||||
v-model="iconName"
|
||||
@focus="onFocus"
|
||||
@clear="onClear"
|
||||
>
|
||||
<a-input ref="inputRef" :style="{ width: '400px' }" placeholder="请选择图标" v-model="iconName" @focus="onFocus">
|
||||
<template #suffix v-if="iconName">
|
||||
<component :is="iconName"></component>
|
||||
</template>
|
||||
<template #append>
|
||||
<span class="icon-reset" @click="reset">重置</span>
|
||||
</template>
|
||||
</a-input>
|
||||
<a-divider />
|
||||
<div class="target-title">当前选择的图标:</div>
|
||||
@ -26,10 +22,12 @@
|
||||
<script setup lang="ts">
|
||||
const iconName = ref<string>("");
|
||||
const SelectIconRef = ref();
|
||||
|
||||
const onFocus = () => {
|
||||
SelectIconRef.value.open();
|
||||
};
|
||||
const onClear = () => {
|
||||
|
||||
const reset = () => {
|
||||
iconName.value = "";
|
||||
};
|
||||
|
||||
@ -47,4 +45,7 @@ const select = (icon: string) => {
|
||||
.target-title {
|
||||
margin-bottom: $margin;
|
||||
}
|
||||
.icon-reset {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
Loading…
x
Reference in New Issue
Block a user