mirror of
https://github.com/element-plus/element-plus.git
synced 2025-01-12 10:45:10 +08:00
fix(switch): cannot change width dynamically (#1435)
Cannot change the width dynamically, the subset does not change the width operation Co-authored-by: djkloop <675467298@qq.com>
This commit is contained in:
parent
7170bdeacc
commit
c37f47faca
@ -26,7 +26,7 @@
|
||||
<i v-if="inactiveIconClass" :class="[inactiveIconClass]"></i>
|
||||
<span v-if="!inactiveIconClass && inactiveText" :aria-hidden="checked">{{ inactiveText }}</span>
|
||||
</span>
|
||||
<span ref="core" class="el-switch__core" :style="{ 'width': coreWidth + 'px' }">
|
||||
<span ref="core" class="el-switch__core" :style="{ 'width': (width || 40) + 'px' }">
|
||||
<div class="el-switch__action">
|
||||
<i v-if="loading" class="el-icon-loading"></i>
|
||||
</div>
|
||||
@ -138,7 +138,6 @@ export default defineComponent({
|
||||
const elForm = inject(elFormKey, {} as ElFormContext)
|
||||
const elFormItem = inject(elFormItemKey, {} as ElFormItemContext)
|
||||
|
||||
const coreWidth = ref(props.width)
|
||||
const isModelValue = ref(props.modelValue !== false)
|
||||
const input = ref(null)
|
||||
const core = ref(null)
|
||||
@ -204,8 +203,6 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
coreWidth.value = coreWidth.value || 40
|
||||
|
||||
if (props.activeValue || props.inactiveValue) {
|
||||
setBackgroundColor()
|
||||
}
|
||||
@ -216,7 +213,6 @@ export default defineComponent({
|
||||
return {
|
||||
input,
|
||||
core,
|
||||
coreWidth,
|
||||
switchDisabled,
|
||||
checked,
|
||||
handleChange,
|
||||
|
Loading…
Reference in New Issue
Block a user