const app = getApp()

Component({

  properties: {
    background: {
      type: String,
      value: '#F4F5F9'
    },
    color: {
      type: String,
      value: '#000'
    },
    text: {
      type: String,
      value: 'Wechat'
    },
    showLocationIf: {
      type: Boolean,
      value: false
    },
    back: {
      type: Boolean,
      value: false
    },
    home: {
      type: Boolean,
      value: false
    }
  },

  data: {
    array: ['A广场', 'B广场-北京西单'],
    index: 1,
    statusBarHeight: app.statusBarHeight + 'px',
    navigationBarHeight: (app.statusBarHeight + 44) + 'px',
    imgHttps: app.globalData.imgHttps,
  },
  methods: {
    backHome: function () {
      tt.switchTab({
        url: `/pages/index/index`,
        success(res) {
          console.log(`${res}`);
        },
        fail(res) {
          console.log(`switchTab调用失败`);
        },
      });
    },
    bindPickerChange: function (e) {
      console.log('picker发送选择改变，携带值为', e.detail.value)
      this.setData({
        index: e.detail.value
      })
    },
    back: function () {
      tt.navigateBack({
        delta: 1
      })
    }
  },
  attached: function(){
    let pages = getCurrentPages();
    if (pages.length <= 1) {
      this.setData({
        back: false
      })
    }
  }
})
