After seeing the @Emit
feature, I checked out the example on GitHub.
import { Vue, Component, Emit } from 'vue-property-decorator'
@Component
export default class YourComponent extends Vue {
count = 0
@Emit()
addToCount(n: number) {
this.count += n
}
}
This code snippet is similar to
export default {
data() {
return {
count: 0
}
},
methods: {
addToCount(n) {
this.count += n
this.$emit('add-to-count', n)
}
}
}
Issue:
I am trying to find a way to modify the parameter n
.
I attempted using a return statement but it did not yield the desired result.
@Emit()
startChange(num:any){
}
The type of the num
parameter is Date
.
My goal is to convert it to a timestamp
and send it to the parent component.
How can I achieve this?