![](/style/images/good.png)
6
![](/style/images/bad.png)
uni-app开发到部署指南 - 搞搞震
source link: https://www.wujingquan.com/posts/6fc00cce.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
部署到H5
刷新404
问题
// App.vue
onLaunch() {
// #ifdef H5
if (e.path == undefined) {
uni.redirectTo({
url: '/pages/index/index'
});
}
// #endif
}
// 导航栏组件
<template>
<view @click="goBack">返回</view>
</template>
<script>
export default {
methods: {
goBack() {
// #ifdef H5
const pages = getCurrentPages()
if (pages.length > 1) {
uni.navigateBack();
} else if (!window.document.referrer.length) {
uni.redirectTo({
url: '/pages/index/index'
});
} else {
history.back()
}
// #endif
// #ifndef H5
uni.navigateBack();
// #endif
}
}
}
</script>
# Nginx
# https://router.vuejs.org/guide/essentials/history-mode.html#nginx
location / {
try_files $uri $uri/ /index.html;
}
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK