yarn dev
启动
Vue & Vuetify
从外面向component里传数据使用props,从component向外面传数据使用事件,可以将对象作为事件的参数抛出。
<template>
<!--DeleteConfirmDialog-->
<v-dialog v-model="show" width="500px">
<v-card>
<v-card-title class="headline"
>Are you sure you want to delete this item?</v-card-title
>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" text @click="closeDelete">Cancel</v-btn>
<v-btn color="blue darken-1" text @click="deleteItemConfirm">OK</v-btn>
<v-spacer></v-spacer>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
export default {
name: "DeleteConfirmDialog",
props: ["show", "formData"],
methods: {
closeDelete: function () {
this.$emit("cancel");
},
deleteItemConfirm: function () {
this.$emit("ok", this.formData);
},
},
};
</script>