반응형
Vue JS Vuetify $emit이 처음 작동하지 않습니다.
2개의 컴포넌트가 있습니다.
- 식기 구성품
- Dish Update 구성 요소
Dish 컴포넌트에서 Dish Update 컴포넌트를 이렇게 Import했습니다.
<template>
<v-layout row wrap>
<v-btn @click="modalShow({name:'pizza'})"></v-btn>
<!--Update Modal -->
<v-dialog v-model="updateDisplay" max-width="80%">
<update-dish></update-dish>
</v-dialog>
<!--Modal -->
</v-layout>
</template>
이건 내 거야modalShow기능.시간이 걸린다dish오브젝트를 생성하여 Dish Update 컴포넌트에 전달합니다.emit.
async modalShow(dish) {
this.$root.$emit("dish", dish);
this.updateDisplay = true;
}
[ Dish Update ]컴포넌트에서 데이터를 취득한 경우mounted수명 주기 후크:
mounted() {
this.$root.$on("dish", dish => {
this.name = dish.name;
}
첫 번째 클릭으로 작동하지 않습니다. 업데이트 구성 요소에 데이터가 전달되지 않습니다.
첫 번째 클릭 후 다시 클릭하면 동작합니다.왜 이런 일이 일어날까요?
vuetify 버전을 1.5에서 2.2.4로 업그레이드하기 전에 작동했습니다.
using@click.native 를 사용해 보세요.
<template>
<v-layout row wrap>
<v-btn @click.native="modalShow({name:'pizza'})"></v-btn>
<!--Update Modal -->
<v-dialog v-model="updateDisplay" max-width="80%">
<update-dish></update-dish>
</v-dialog>
<!--Modal -->
</v-layout>
</template>
이미 알려진 문제이므로 vuetify github에서 확인할 수 있습니다.
언급URL : https://stackoverflow.com/questions/59840814/vue-js-vuetify-emit-is-not-working-on-first-time
반응형
'source' 카테고리의 다른 글
| MySQL 5.7의 기본 루트 패스워드는 무엇입니까? (0) | 2022.11.12 |
|---|---|
| MySQL 데이터베이스를 SQL Server로 가져오기 (0) | 2022.11.12 |
| 플레인 JavaScript에서 "hasClass" 함수는 무엇입니까? (0) | 2022.11.12 |
| CSV를 디스크에 저장하지 않고 CSV 형식의 데이터를 메모리에서 데이터베이스로 전송하려면 어떻게 해야 합니까? (0) | 2022.11.12 |
| UnicodeEncodeError: 'charmap' 코덱은 문자를 인코딩할 수 없습니다. (0) | 2022.11.12 |