分享你我的心得.
共乘一片美好网络.

关于Page和Component共同使用的问题

不能共生  只能把page 里面代码 转移到 Component

如下

Component({
    pageLifetimes: {
        show() {
            if (typeof this.getTabBar === 'function' &&
                this.getTabBar()) {
                this.getTabBar().setData({
                    selected: 0
                })
            }
        }
    },
    /**
     * 页面的初始数据
     */
    data: {
 
    },
    methods: {
        /**
         * 生命周期函数--监听页面加载
         */
        onLoad: function(options) {
 
        },
 
        /**
         * 生命周期函数--监听页面初次渲染完成
         */
        onReady: function() {
 
        },
 
        /**
         * 生命周期函数--监听页面显示
         */
        onShow: function() {
 
        },
 
        /**
         * 生命周期函数--监听页面隐藏
         */
        onHide: function() {
 
        },
 
    }
})

赞(0)
未经允许不得转载:小叶白龙博客 » 关于Page和Component共同使用的问题
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址