<template>
<view @click="do">页面重载</view>
</template>
<script>
export default {
methods: {
// 使用:在要用的地方直接调用 this.reload()
do() {
this.reload();
},
// 页面重载
reload() {
// 页面重载
const pages = getCurrentPages();
// 声明一个pages使用getCurrentPages方法
const curPage = pages[pages.length - 1];
curPage.onShow();
curPage.onReady();
// 执行刷新
},
},
};
</script>