新增404页面
This commit is contained in:
parent
3616325071
commit
eac0a03924
@ -8,6 +8,12 @@
|
|||||||
},
|
},
|
||||||
onHide: function() {
|
onHide: function() {
|
||||||
console.log('App Hide')
|
console.log('App Hide')
|
||||||
|
},
|
||||||
|
onPageNotFound() {
|
||||||
|
// 跳转到 404 页面:
|
||||||
|
uni.redirectTo({
|
||||||
|
url: "pages/error/error"
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -16,4 +22,4 @@
|
|||||||
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
|
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
|
||||||
@import "uview-ui/index.scss";
|
@import "uview-ui/index.scss";
|
||||||
@import "static/css/iconfont.css";
|
@import "static/css/iconfont.css";
|
||||||
</style>
|
</style>
|
@ -110,6 +110,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
,{
|
||||||
|
"path" : "pages/error/error",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText": "404",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
"navigationBarTextStyle": "black",
|
"navigationBarTextStyle": "black",
|
||||||
|
@ -0,0 +1,70 @@
|
|||||||
|
<template>
|
||||||
|
<view class="error">
|
||||||
|
<text class="title">页面迷路啦~</text>
|
||||||
|
<text class="info">请确认访问地址是否有误</text>
|
||||||
|
<u-button type="primary" class="btn-home" @click="goHome">返回首页</u-button>
|
||||||
|
<u-button type="success" @click="goWebsite">前往官网</u-button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
goHome(){
|
||||||
|
uni.switchTab({
|
||||||
|
url:'/pages/index/index'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
goWebsite(){
|
||||||
|
// #ifdef H5
|
||||||
|
window.open("https://net.linfeng.tech")
|
||||||
|
// #endif
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
uni.navigateToMiniProgram({
|
||||||
|
appId: 'wx1d4a8967c92bda9b',
|
||||||
|
path: 'pages/index/index',
|
||||||
|
success: res => {
|
||||||
|
console.log("打开成功", res);
|
||||||
|
},
|
||||||
|
fail: err => {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.error {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 80vh;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
margin-bottom: 100rpx;
|
||||||
|
color: #aaaaff;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-home {
|
||||||
|
margin-bottom: 40rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
x
Reference in New Issue
Block a user