How to refresh the component #8098
-
How to refresh the component |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You can add key in element label
|
Beta Was this translation helpful? Give feedback.
-
this is my answer, it may be helpful https://stackoverflow.com/a/79302293/17601704 In vue router 4 for vue3 firsttry to find the mounted APP.vue, when you refresh the webpage, the App.vue will be loaded firstly. So make sure you don't mounted mounted() {
this.$router.push("/");
} the correct thing mounted() {
this.loading();
},
methods: {
loading() {
if(document.URL=="http://localhost:9000/" || document.URL=="https://zoujiu.com.cn/"
|| document.URL=="http://zoujiu.com.cn/" || document.URL=="http://localhost:9000/#/"
|| document.URL=="http://zoujiu.com.cn/#/"|| document.URL=="https://zoujiu.com.cn/#/"
) {
this.$router.push({ path: '/'});
}
}
} deploymentI use this history with nginx ssl https const router = createRouter({
// history: createMemoryHistory(),
history: createWebHashHistory(),
// history: createWebHistory(),
routes:constantRoutes,
}) developmentI use this history const router = createRouter({
// history: createMemoryHistory(),
// history: createWebHashHistory(),
history: createWebHistory(),
routes:constantRoutes,
}) this is myown website http://zoujiu.com.cn. |
Beta Was this translation helpful? Give feedback.
You can add key in element label
Try it