chore: 升级vue^3.4.0,整体性能得到不错的提升

This commit is contained in:
xiaoxian521
2023-12-29 23:11:23 +08:00
parent f7883606c8
commit 50a4b177d4
4 changed files with 195 additions and 219 deletions

View File

@@ -7,15 +7,8 @@ defineOptions({
name: "ReAnimateSelector"
});
const props = defineProps({
modelValue: {
require: false,
type: String
}
});
const emit = defineEmits<{ (e: "update:modelValue", v: string) }>();
const inputValue = defineModel({ type: String });
const inputValue = toRef(props, "modelValue");
const animatesList = ref(animates);
const copyAnimatesList = cloneDeep(animatesList);
@@ -47,11 +40,11 @@ const animateStyle = computed(
);
function onChangeIcon(animate: string) {
emit("update:modelValue", animate);
inputValue.value = animate;
}
function onClear() {
emit("update:modelValue", "");
inputValue.value = "";
}
function filterMethod(value: any) {

View File

@@ -10,15 +10,8 @@ defineOptions({
name: "IconSelect"
});
const props = defineProps({
modelValue: {
require: false,
type: String
}
});
const emit = defineEmits<{ (e: "update:modelValue", v: string) }>();
const inputValue = defineModel({ type: String });
const inputValue = toRef(props, "modelValue");
const iconList = ref(IconJson);
const icon = ref();
const currentActiveType = ref("ep:");
@@ -68,11 +61,11 @@ const iconItemStyle = computed((): ParameterCSSProperties => {
});
function setVal() {
currentActiveType.value = props.modelValue.substring(
currentActiveType.value = inputValue.value.substring(
0,
props.modelValue.indexOf(":") + 1
inputValue.value.indexOf(":") + 1
);
icon.value = props.modelValue.substring(props.modelValue.indexOf(":") + 1);
icon.value = inputValue.value.substring(inputValue.value.indexOf(":") + 1);
}
function onBeforeEnter() {
@@ -96,7 +89,7 @@ function handleClick({ props }) {
function onChangeIcon(item) {
icon.value = item;
emit("update:modelValue", currentActiveType.value + item);
inputValue.value = currentActiveType.value + item;
}
function onCurrentChange(page) {
@@ -105,7 +98,7 @@ function onCurrentChange(page) {
function onClear() {
icon.value = "";
emit("update:modelValue", "");
inputValue.value = "";
}
watch(
@@ -117,7 +110,7 @@ watch(
{ immediate: true }
);
watch(
() => props.modelValue,
() => inputValue.value,
val => val && setVal(),
{ immediate: true }
);