阅读量:0
vue2
fireTicketEdit.vue
<baseInfo :ticket.sync="ticketForm" />
baseInfo.vue
<script> export default { props: { ticket: Object }, computed: { ticketForm: { get() { return this.ticket }, set(newValue) { this.$emit('update:ticket', newValue) } } }, methods: { deleteWorkOrder() { this.ticketForm.workOrderId = null } } } </script>
vue3
fireTicketEdit.vue
<baseInfo v-model:ticket="ticketForm" />
baseInfo.vue
<script setup> import { computed, emit } from 'vue' const props = defineProps({ ticket: Object }) const ticketForm = computed({ get() { return props.ticket }, set(newValue) { emit('update:ticket', newValue) } }) function deleteWorkOrder() { ticketForm.value.workOrderId = null } </script>