部署到H5
刷新404
问题
onLaunch() {
if (e.path == undefined) {
uni.redirectTo({
url: '/pages/index/index'
});
}
}
<template>
<view @click="goBack">返回</view>
</template>
<script>
export default {
methods: {
goBack() {
const pages = getCurrentPages()
if (pages.length > 1) {
uni.navigateBack();
} else if (!window.document.referrer.length) {
uni.redirectTo({
url: '/pages/index/index'
});
} else {
history.back()
}
uni.navigateBack();
}
}
}
</script>
# Nginx
# https://router.vuejs.org/guide/essentials/history-mode.html
location / {
try_files $uri $uri/ /index.html;
}