1.代码优化

v1.0.0
sws 2024-09-05 10:50:15 +08:00
parent fedf7db1e1
commit 969c835563
3 changed files with 9 additions and 9 deletions

View File

@ -11,7 +11,7 @@
</div>
<div class="flex-row align-c" :class="'gap-' + base_data.img_space">
<div v-for="(item, index) in icon_setting" :key="index" :style="{ width: base_data.img_size + 'px', height: base_data.img_size + 'px' }">
<image-empty v-if="item.src.length > 0" v-model="item.src[0]" :error-img-style="'width: ' + Number(base_data.img_size) / 2 + 'px;height:' + Number(base_data.img_size) / 2 + 'px;'"></image-empty>
<image-empty v-if="item.img.length > 0" v-model="item.img[0]" :error-img-style="'width: ' + Number(base_data.img_size) / 2 + 'px;height:' + Number(base_data.img_size) / 2 + 'px;'"></image-empty>
<icon v-else :name="item.icon" :size="base_data.img_size + ''" color="6"></icon>
</div>
</div>
@ -46,14 +46,14 @@ const stats_list = reactive([
]);
interface icon_params {
id: string;
src: uploadList[];
img: uploadList[];
icon: string;
href: string;
}
const user_info = ref<string[]>(['1', '2', '3', '4']);
const icon_setting = ref<icon_params[]>([
{ id: '1', src: [], icon: '', href: 'a' },
{ id: '2', src: [], icon: '', href: 'a' },
{ id: '1', img: [], icon: '', href: 'a' },
{ id: '2', img: [], icon: '', href: 'a' },
]);
const base_data = reactive({
//

View File

@ -16,7 +16,7 @@
<div class="nav-list">
<drag :data="form.icon_setting" :space-col="20" @remove="icon_setting_remove" @on-sort="icon_setting_sort">
<template #default="{ row }">
<upload v-model="row.src" v-model:icon-value="row.icon" is-icon type="img" :limit="1" :styles="2" :size="30"></upload>
<upload v-model="row.img" v-model:icon-value="row.icon" is-icon type="img" :limit="1" :styles="2" :size="30"></upload>
<url-value v-model="row.href"></url-value>
</template>
</drag>
@ -52,7 +52,7 @@ const icon_setting_sort = (item: any) => {
const add = () => {
form.icon_setting.push({
id: get_math(),
src: [],
img: [],
icon: '',
href: {},
});

View File

@ -2,7 +2,7 @@ import defaultCommon from './index';
interface DefaultUserInfo {
content: {
user_info: string[];
icon_setting: { id: string; src: uploadList[]; href: object; icon: string }[];
icon_setting: { id: string; img: uploadList[]; href: object; icon: string }[];
};
style: {
user_avatar_size: string;
@ -29,8 +29,8 @@ const defaultUserInfo: DefaultUserInfo = {
content: {
user_info: ['1', '2', '3', '4', '5'],
icon_setting: [
{ id: '1', src: [], icon: 'applet-me-settings-acquiesce', href: {} },
{ id: '2', src: [], icon: 'applet-me-message-acquiesce', href: {} },
{ id: '1', img: [], icon: 'applet-me-settings-acquiesce', href: {} },
{ id: '2', img: [], icon: 'applet-me-message-acquiesce', href: {} },
],
},
style: {