12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- const app = getApp();
- Component({
- /**
- * 组件的一些选项
- */
- options: {
- addGlobalClass: true,
- multipleSlots: true
- },
- /**
- * 组件的对外属性
- */
- properties: {
- bgColor: {
- type: String,
- default: ''
- },
- isCustom: {
- type: [Boolean, String],
- default: false
- },
- isBack: {
- type: [Boolean, String],
- default: false
- },
- isShare:{
- type: [Boolean, String],
- default: false
- },
- bgImage: {
- type: String,
- default: ''
- },
- },
- /**
- * 组件的初始数据
- */
- data: {
- StatusBar: app.globalData.StatusBar,
- CustomBar: app.globalData.CustomBar,
- Custom: app.globalData.Custom
- },
- /**
- * 组件的方法列表
- */
- methods: {
- BackPage() {
- if( this.data.isShare ){
- console.log( "share to home" );
- wx.reLaunch({
- url: '/pages/index/index',
- });
- }else{
- console.log("back");
- wx.navigateBack({
- delta: 1
- });
- }
- },
- toHome(){
- console.log("tohome")
- let curPage = getCurrentPages()
- let index = -1;
- for( let i in curPage){
- let route = curPage[i].route.split("?")[0];
- if (route == 'pages/index/index'){
- index = i;
- break;
- }
- }
- if( index == -1){
- wx.reLaunch({
- url: '/pages/index/index',
- })
- }else{
- wx.navigateBack({
- delta: curPage.length - index-1
- })
- }
- }
- }
- })
|