Rumah > Soal Jawab > teks badan
P粉2783794952023-08-18 13:12:55
Anda harus menukar beberapa sifat dalam kod anda Anda menulis disabilityState dan bukannya disabledState
<template> <button id="idDigitizePolygonBtn" class="clsDigitizePolygonBtn" :disabled="disabledState"> <slot name="slotDigitizePolygonBtnLabel">text</slot> </button> </template> <script> export default { setup(props) { return { disabledState: props.isDigitizePolygonBtnDisabled, }; }, props: { isDigitizePolygonBtnDisabled: { type: Boolean, required: true, default: false, }, }, }; </script>
Dalam komponen induk anda, anda harus menyerahkan harta isDigitizePolygonBtnDisabled kepada komponen anak dan bukannya disabledState. Perubahan yang dibuat kepada komponen induk:
<template> <DigitizePolygonButton :isDigitizePolygonBtnDisabled="false"> <template v-slot:slotDigitizePolygonBtnLabel> <button>测试按钮</button> </template> </DigitizePolygonButton> </template>
Membuat perubahan ini sepatutnya berfungsi dengan baik.