123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- // commpents/mobile-frame/mobile-main.js
- const app = getApp()
- Component({
- /**
- * 组件的属性列表
- */
- options: { multipleSlots: true },
- properties: {
- tabSelectid: { type: 'string', value: '' }
- },
- // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
- attached: function () { }, // 此处attached的声明会被lifetimes字段中的声明覆盖
- ready: function () { },
- pageLifetimes: {
- // 组件所在页面的生命周期函数
- show: function () { this.search() },
- hide: function () { },
- resize: function () { },
- },
- /**
- * 组件的初始数据
- */
- data: {
- active: '0'
- },
- /**
- * 组件的方法列表
- */
- methods: {
- // 返回上一级
- tabPath(e) {
- this.triggerEvent('tabPath', { index: e.detail })
- },
- search() {
- let pages = getCurrentPages();
- let currentPage = pages[pages.length - 1];
- if (currentPage.route == 'pages/market/index') {
- this.setData({ active: 0 })
- } else {
- this.setData({ active: 1 })
- }
- }
- }
- })
|