|
@@ -23,24 +23,18 @@ const _props = defineProps({
|
|
|
default: 0
|
|
|
}
|
|
|
})
|
|
|
-watch(
|
|
|
- () => _props.modelValue,
|
|
|
- (n, o) => {
|
|
|
- computedRatioNumC(n)
|
|
|
- }
|
|
|
-)
|
|
|
const _emit = defineEmits<{ (e: 'update:modelValue', v: number): void }>()
|
|
|
-const ratioNum1 = ref<any>()
|
|
|
-const ratioNum2 = ref<any>()
|
|
|
+const ratioNum1 = ref<any>(0)
|
|
|
+const ratioNum2 = ref<any>(0)
|
|
|
const shareRatioIndex = ref<string>('')
|
|
|
const shareRatioMap = reactive<any>({
|
|
|
'1': [58, 42],
|
|
|
'2': [62.5, 37.5],
|
|
|
- '3': []
|
|
|
+ '3': [0, 0]
|
|
|
})
|
|
|
const setRatioNumC = (): void => {
|
|
|
- shareRatioMap['c'][0] = parseFloat(ratioNum1.value)
|
|
|
- shareRatioMap['c'][1] = parseFloat(ratioNum2.value)
|
|
|
+ shareRatioMap['3'][0] = parseFloat(ratioNum1.value)
|
|
|
+ shareRatioMap['3'][1] = parseFloat(ratioNum2.value)
|
|
|
}
|
|
|
const computedRatioNumC = (v): void => {
|
|
|
const num2 = v * 100
|
|
@@ -61,7 +55,7 @@ const computedRatioNumC = (v): void => {
|
|
|
}
|
|
|
const ratioChangeHandle = (): void => {
|
|
|
const index: string = shareRatioIndex.value
|
|
|
- if (index == 'c') {
|
|
|
+ if (index == '3') {
|
|
|
const ratio: number = shareRatioMap[index][1] / 100
|
|
|
_emit('update:modelValue', ratio)
|
|
|
}
|
|
@@ -82,6 +76,15 @@ const radioChange = (): void => {
|
|
|
const ratio: number = shareRatioMap[index][1] / 100
|
|
|
_emit('update:modelValue', ratio)
|
|
|
}
|
|
|
+watch(
|
|
|
+ () => _props.modelValue,
|
|
|
+ (n, o) => {
|
|
|
+ computedRatioNumC(n)
|
|
|
+ },
|
|
|
+ {
|
|
|
+ immediate: true
|
|
|
+ }
|
|
|
+)
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|