商品管理新增分布表单,修改部分表单项,首页移除自定义面板
This commit is contained in:
1 parent
8b863ccd96
commit
0a34e1e894
9 files changed
+500
-543
No files matched your search
@@ -1,50 +1,43 @@
|
||||
<template>
|
||||
<div class="flex flex-wrap items-center gap-2 max-w-full">
|
||||
<el-tag
|
||||
v-for="tag in tags"
|
||||
:key="tag"
|
||||
:type="tagType"
|
||||
closable
|
||||
:disable-transitions="false"
|
||||
@close="handleClose(tag)"
|
||||
>
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
<el-input
|
||||
v-if="inputVisible"
|
||||
ref="InputRef"
|
||||
v-model="inputValue"
|
||||
class="w-20"
|
||||
size="small"
|
||||
@keyup.enter="handleInputConfirm"
|
||||
@blur="handleInputConfirm"
|
||||
/>
|
||||
<el-button v-else class="button-new-tag" size="small" @click="showInput">
|
||||
{{ buttonText }}
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2 max-w-full">
|
||||
<el-tag v-for="tag in tags" :key="tag" :type="tagType" closable :disable-transitions="false" @close="handleClose(tag)">
|
||||
{{ tag }}
|
||||
</el-tag>
|
||||
<el-input
|
||||
v-if="inputVisible"
|
||||
ref="InputRef"
|
||||
v-model="inputValue"
|
||||
class="w-20"
|
||||
size="small"
|
||||
@keyup.enter="handleInputConfirm"
|
||||
@blur="handleInputConfirm"
|
||||
/>
|
||||
<el-button v-else class="button-new-tag" size="small" @click="showInput">
|
||||
{{ buttonText }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {ref, nextTick, defineProps, defineEmits} from 'vue';
|
||||
import {ElInput} from 'element-plus';
|
||||
import { ref, nextTick } from 'vue';
|
||||
import { ElInput } from 'element-plus';
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Array as () => string[],
|
||||
default: () => []
|
||||
},
|
||||
buttonText: {
|
||||
type: String,
|
||||
default: '+ New Tag'
|
||||
},
|
||||
tagType: {
|
||||
type: String,
|
||||
default: 'primary',
|
||||
validator: (value: string) => {
|
||||
return ['primary', 'success', 'info', 'warning', 'danger'].includes(value);
|
||||
}
|
||||
}
|
||||
modelValue: {
|
||||
type: Array as () => string[],
|
||||
default: () => [],
|
||||
},
|
||||
buttonText: {
|
||||
type: String,
|
||||
default: '+ New Tag',
|
||||
},
|
||||
tagType: {
|
||||
type: String,
|
||||
default: 'primary',
|
||||
validator: (value: string) => {
|
||||
return ['primary', 'success', 'info', 'warning', 'danger'].includes(value);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const emits = defineEmits(['update:modelValue']);
|
||||
@@ -56,27 +49,30 @@ const InputRef = ref<InstanceType<typeof ElInput>>();
|
||||
const tags = ref([...props.modelValue]);
|
||||
|
||||
const handleClose = (tag: string) => {
|
||||
tags.value.splice(tags.value.indexOf(tag), 1);
|
||||
emits('update:modelValue', tags.value);
|
||||
tags.value.splice(tags.value.indexOf(tag), 1);
|
||||
emits('update:modelValue', tags.value);
|
||||
};
|
||||
|
||||
watch(() => props.modelValue, (val) => {
|
||||
tags.value = val;
|
||||
});
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(val) => {
|
||||
tags.value = val;
|
||||
}
|
||||
);
|
||||
|
||||
const showInput = () => {
|
||||
inputVisible.value = true;
|
||||
nextTick(() => {
|
||||
InputRef.value!.input!.focus();
|
||||
});
|
||||
inputVisible.value = true;
|
||||
nextTick(() => {
|
||||
InputRef.value!.input!.focus();
|
||||
});
|
||||
};
|
||||
|
||||
const handleInputConfirm = () => {
|
||||
if (inputValue.value) {
|
||||
tags.value.push(inputValue.value);
|
||||
emits('update:modelValue', tags.value);
|
||||
}
|
||||
inputVisible.value = false;
|
||||
inputValue.value = '';
|
||||
if (inputValue.value) {
|
||||
tags.value.push(inputValue.value);
|
||||
emits('update:modelValue', tags.value);
|
||||
}
|
||||
inputVisible.value = false;
|
||||
inputValue.value = '';
|
||||
};
|
||||
</script>
|
||||
@@ -72,7 +72,7 @@ interface UploadFileProps {
|
||||
borderRadius?: string; // 组件边框圆角 ==> 非必传(默认为 8px)
|
||||
iconSize?: number;
|
||||
dir?: string; // 文件目录
|
||||
listType: string;
|
||||
listType?: string;
|
||||
}
|
||||
|
||||
// 接受父组件参数
|
||||
|
||||
Reference in new issue
Block a user