修复组件打包后出现问题

This commit is contained in:
吕金泽 2022-03-25 17:14:28 +08:00
parent bb91e96638
commit 43976afbee
5 changed files with 36 additions and 9 deletions

View File

@ -1,6 +1,6 @@
<template>
<el-date-picker
v-model="modelValue"
v-model="selectValue"
:type="type"
:format="format"
:value-format="valueFormat"
@ -14,6 +14,7 @@
<script setup>
import { watch, ref } from 'vue'
const emit = defineEmits(['update:modelValue'])
const selectValue = ref('')
const props = defineProps({
modelValue: String,
type: String,
@ -35,8 +36,13 @@
},
props: Object
})
const valueFormat = ref(props.format)
selectValue.value = props.modelValue
watch(() => props.modelValue, (value) => {
selectValue.value = value
})
const valueFormat = ref(props.format)
watch(selectValue, (value) => {
emit('update:modelValue', value)
})
</script>

View File

@ -1,10 +1,11 @@
<template>
<el-input v-model="modelValue" :type="type" :placeholder="placeholder || (itemLabel && '请输入' + itemLabel)" v-bind="props.props" />
<el-input v-model="selectValue" :type="type" :placeholder="placeholder || (itemLabel && '请输入' + itemLabel)" v-bind="props.props" />
</template>
<script setup>
import { watch } from 'vue'
import {ref, watch} from 'vue'
const emit = defineEmits(['update:modelValue'])
const selectValue = ref('')
const props = defineProps({
modelValue: String,
itemLabel: String,
@ -12,7 +13,11 @@
type: String,
props: Object
})
selectValue.value = props.modelValue
watch(() => props.modelValue, (value) => {
selectValue.value = value
})
watch(selectValue, (value) => {
emit('update:modelValue', value)
})
</script>

View File

@ -1,6 +1,6 @@
<template>
<el-radio-group
v-model="modelValue"
v-model="selectValue"
:size="size"
:disabled="disabled"
:text-color="textColor"
@ -22,6 +22,7 @@
const emit = defineEmits(['update:modelValue', 'change'])
const { proxy } = getCurrentInstance()
const selectValue = ref('')
const props = defineProps({
modelValue: String | Number | Boolean,
type: String,
@ -59,6 +60,8 @@
}
})
selectValue.value = props.modelValue
const options = ref([])
if(props.type){
@ -83,8 +86,10 @@
function change(value){
emit('change', value)
}
watch(() => props.modelValue, (value) => {
selectValue.value = value
})
watch(selectValue, (value) => {
emit('update:modelValue', value)
})
</script>

View File

@ -1,6 +1,6 @@
<template>
<el-switch
v-model="modelValue"
v-model="selectValue"
:active-value="activeValue"
:inactive-value="inactiveValue"
v-bind="props.props"
@ -8,8 +8,9 @@
</template>
<script setup>
import { watch } from 'vue'
import {ref, watch} from 'vue'
const emit = defineEmits(['update:modelValue'])
const selectValue = ref(false)
const props = defineProps({
modelValue: {
type: Boolean,
@ -19,7 +20,12 @@
inactiveValue: Boolean | String | Number,
props: Object
})
selectValue.value = props.modelValue
watch(() => props.modelValue, (value) => {
selectValue.value = value
})
watch(selectValue, (value) => {
emit('update:modelValue', value)
})
</script>

View File

@ -1,10 +1,11 @@
<template>
<treeselect v-model="modelValue" :options="options" :key="modelValue" :placeholder="placeholder || (itemLabel && '请选择' + itemLabel)" :show-count="true" v-bind="props.props" />
<treeselect v-model="selectValue" :options="options" :key="modelValue" :placeholder="placeholder || (itemLabel && '请选择' + itemLabel)" :show-count="true" v-bind="props.props" />
</template>
<script setup>
import { ref, getCurrentInstance, watch } from "vue"
const emit = defineEmits(['update:modelValue'])
const selectValue = ref(null)
const { proxy } = getCurrentInstance()
const props = defineProps({
modelValue: {
@ -21,7 +22,11 @@
props: Object
})
selectValue.value = props.modelValue
watch(() => props.modelValue, (value) => {
selectValue.value = value
})
watch(selectValue, (value) => {
emit('update:modelValue', value)
})