🐛(component): 修复 rate 组件 modelValue 缺少响应式

This commit is contained in:
就眠儀式 2022-09-13 06:40:28 +08:00
parent 9d558c798e
commit 800aa23eff
3 changed files with 15 additions and 4 deletions

View File

@ -5,7 +5,7 @@ export default {
</script>
<script setup lang="ts">
import { computed, ref, withDefaults } from "vue";
import { computed, ref, watch, withDefaults } from "vue";
import "./index.less";
export interface LayRateProps {
@ -47,6 +47,10 @@ const isHalf = computed(
() => props.half && Math.round(currentValue.value) !== currentValue.value
);
watch(() => props.modelValue, () => {
currentValue.value = props.modelValue;
tempValue.value = props.modelValue;
})
//
const getValue = function (index: number, event: any): number {
if (!props.half) {

View File

@ -17,13 +17,17 @@
</template>
<script>
import { ref } from 'vue';
import { ref, onMounted } from 'vue';
export default {
setup() {
const all1 = ref(0)
onMounted(() => {
all1.value = 4
})
return {
all1
}

View File

@ -1394,7 +1394,8 @@ export default {
:columns="columns5"
:expand-index="1"
:data-source="dataSource5"
:checkbox="checkbox5" :page="page5"
:checkbox="checkbox5"
:page="page5"
:default-toolbar="defaultToolbar5"
v-model:selected-keys="selectedKeys5"
@row="rowClick5">
@ -1403,6 +1404,7 @@ export default {
<lay-button size="sm">删除</lay-button>
</template>
<template v-slot:name="{ data }"> {{data.name}} </template>
<template v-slot:remark="{ data }"> {{data.remark}} </template>
<template v-slot:name-title>😊</template>
<template v-slot:birthday="{ data }"> {{data.birthday}} </template>
<template v-slot:operator="{ data }">
@ -1457,8 +1459,9 @@ export default {
},
{
title:"备注",
width: "300px",
width: "100px",
key:"remark",
customSlot:"remark",
ellipsisTooltip: true,
}
,{