2024-03-22 16:10:50 +08:00

59 lines
1.2 KiB
JavaScript

// commpents/te_navbar/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
navbarData: { //navbarData 由父页面传递的数据,变量名字自命名
type: Object,
value: {
showCapsule: 1, //是否显示胶囊
title: '标题文字', //导航栏 中间的标题}
}
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
onBack() {
console.log("onBackonBackonBack");
let back_url = this.data.navbarData.back_url;
let back_url_type = this.data.navbarData.back_url_type;
console.log("--------");
console.log(back_url);
if(back_url){
if(back_url_type == 0){
app.go(back_url);
}else{
wx.reLaunch({
url: back_url,
});
}
}else{
wx.navigateBack({
fail:function(){
wx.reLaunch({
delta:1,
url: '/Pages/yishi/index/index',
})
}
});
}
},
onGoHome() {
wx.reLaunch({
url: '/Pages/index/index?from=navbar',
});
},
},
})