1
this 튜토리얼을 따르려고합니다. 아래 코드를 사용하여 Modal
이 표시됩니다..vue 파일에서 다른 .vue 파일로 템플릿을 전달하십시오.
<modal
v-model="showModal"
:animation-duration="animationDuration"
:close-on-click-away="closeOnClickAway"
>
<p slot="header">Confirmation needed</p>
<p slot="content">Do you want to continue?</p>
<template slot="actions">
<div class="ui black deny button"
@click="showModal=false">
No
</div>
<div class="ui positive right labeled icon button"
@click="confirm">
Yes
<i class="checkmark icon"></i>
</div>
</template>
</modal>
여기에 내가 ModalBody.vue
라는 이름의 또 다른 .vue
파일의 코드 부분 아래에 배치하고 싶습니다.
<p slot="header">Confirmation needed</p>
<p slot="content">Do you want to continue?</p>
<template slot="actions">
<div class="ui black deny button"
@click="showModal=false">
No
</div>
<div class="ui positive right labeled icon button"
@click="confirm">
Yes
<i class="checkmark icon"></i>
</div>
</template>
은 그 때 나는
<modal
v-model="showModal"
:animation-duration="animationDuration"
:close-on-click-away="closeOnClickAway"
>
<modal-body></modal-body>
</modal>
아래처럼 해당 파일에 액세스하려고하지만 그것은 작동하지 않습니다. 콘솔에서도 오류가 발생하지 않습니다.
UPDATE
Parent.vue
<template>
<modal
v-model="showModal"
:animation-duration="animationDuration"
:close-on-click-away="closeOnClickAway"
>
<modal-body></modal-body>
</modal>
</div>
</template>
<script>
import ModalBody from './ModalBody';
export default {
components: { ModalBody },
}
</script>
'childComponent'는'modalBody'이어야 또한 명확하지가 설립 한 경우 방법을 'showModal'의 값을 토글합니다 ... – nickford
@Volodymyr Synmonenko에게 답장을 보내 주셔서 감사합니다. 솔루션이 작동하지 않습니다. 내 질문을 업데이트했습니다. 그게 너에게 도움이 될 것 같아. 고마워. –
@abuabu, 나는 대답을 –