Skip to content

Commit

Permalink
Merge pull request #194 from wsw2000/main
Browse files Browse the repository at this point in the history
fix: 修复菜单编辑选择图标未能清除问题
  • Loading branch information
kanyxmo authored Jul 2, 2024
2 parents 5bfca95 + 5cc245b commit 4acb1c7
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/components/ma-icon/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,31 @@
</template>

<script setup>
import { reactive, ref, onMounted } from 'vue'
import { reactive, ref, computed } from 'vue'
import * as arcoIcons from '@arco-design/web-vue/es/icon'

const mineadminIcons = reactive([])
const arcodesignIcons = reactive([])
const visible = ref(false)
const currentIcon = ref()

const props = defineProps({
modelValue: { type: String },
preview: { type: Boolean, default: true },
})

const emit = defineEmits(['update:modelValue'])

onMounted( () => currentIcon.value = props.modelValue )
const currentIcon = computed({
get() {
return props.modelValue;
},
set(value) {
// html标签名不能以数字开头
if ((/^[^\d].*/.test(value) && value) || !value) {
emit('update:modelValue', value);
}
}
});

for (let icon in arcoIcons) {
arcodesignIcons.push(icon)
Expand All @@ -79,7 +88,6 @@

const selectIcon = (icon, className) => {
currentIcon.value = icon
emit('update:modelValue', currentIcon.value)
visible.value = false
}

Expand Down

0 comments on commit 4acb1c7

Please sign in to comment.