|
|
@@ -3,10 +3,13 @@
|
|
|
<h1 v-if="error.statusCode === 404">
|
|
|
{{ pageNotFound }}
|
|
|
</h1>
|
|
|
- <h1 v-else>
|
|
|
- {{ otherError }}
|
|
|
- </h1>
|
|
|
- <NuxtLink to="/"> Home page </NuxtLink>
|
|
|
+ <div v-else>
|
|
|
+ <h1>
|
|
|
+ {{ otherError }}
|
|
|
+ </h1>
|
|
|
+ <van-button type="primary" @click="refreshPage">主要按钮</van-button>
|
|
|
+ </div>
|
|
|
+ <!-- <NuxtLink to="/"> Home page </NuxtLink> -->
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -27,12 +30,29 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
head() {
|
|
|
+ console.log('tempErr',this.error)
|
|
|
const title =
|
|
|
this.error.statusCode === 404 ? this.pageNotFound : this.otherError;
|
|
|
return {
|
|
|
title,
|
|
|
};
|
|
|
},
|
|
|
+ methods: {
|
|
|
+ // 刷新页面
|
|
|
+ refreshPage() {
|
|
|
+ const currentPath = this.$route.path;
|
|
|
+ const queryParams = this.$route.query;
|
|
|
+
|
|
|
+ // 添加一个随机参数以确保刷新
|
|
|
+ this.$router.replace({
|
|
|
+ path: currentPath,
|
|
|
+ query: {
|
|
|
+ ...queryParams,
|
|
|
+ _refresh: Date.now()
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
};
|
|
|
</script>
|
|
|
|