🐛 修复 icon-picker 选择图标自动隐藏内容

This commit is contained in:
就眠儀式
2021-12-17 00:07:15 +08:00
parent 43e4ab7ade
commit 7873134d81
3 changed files with 60 additions and 49 deletions

View File

@@ -1,5 +1,5 @@
<template>
<lay-dropdown>
<lay-dropdown ref="dropdownRef">
<div
class="
layui-inline layui-border-box layui-iconpicker layui-iconpicker-split
@@ -85,17 +85,18 @@
import { defineProps, Ref, ref } from 'vue'
import { LayIconList as icons } from "@layui/icons-vue"
const props = withDefaults(
defineProps<{
modelValue?: string
page?: boolean
export interface LayIconPickerProps {
page?: boolean,
modelValue?: string,
showSearch?: boolean
}>(),
{
}
const props = withDefaults(defineProps<LayIconPickerProps>(),{
modelValue: 'layui-icon-face-smile',
page: false,
}
)
})
const dropdownRef = ref<null | HTMLElement>(null);
const emit = defineEmits(['update:modelValue'])
@@ -104,6 +105,8 @@ const selectedIcon: Ref<string> = ref(props.modelValue as string)
const selectIcon = function (icon: string) {
emit('update:modelValue', icon)
selectedIcon.value = icon
// @ts-ignore
dropdownRef.value.hide()
}
const icones: Ref = ref([])