注册事件
2018-11-23 本文已影响4人
江火渔枫
1.组件
{
methods: {
onPageChange() {
//换页时会emit一个事件
this.$emit('page-change', this.currentPage);
}
}
}
2.父组件接收
<template>
<pagination :page-change="onPageChange">
</pagination>
</template>
<script>
export default {
// ....
methods: {
onPageChange(page) {
console.log(page);
}
}
}
</script>