vue2
fireTicketEdit.vue
html
<baseInfo :ticket.sync="ticketForm" />
baseInfo.vue
javascript
<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
html
<baseInfo v-model:ticket="ticketForm" />
baseInfo.vue
javascript
<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>