123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- // pages/test/index.js
- const app = getApp()
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- frameStyle: { useTop: true, name: '测试页面', leftArrow: true, useBar: true },
- // 主体高度
- infoHeight: '',
- // 图片
- img_url: [],
- // dialog弹框
- dialog: { title: '弹框标题', show: false, type: '1' },
- // 选项卡
- tabs: {
- active: 'a',
- list: [
- { title: '选项卡一', name: 'a' },
- { title: '选项卡二', name: 'b' },
- { title: '选项卡三', name: 'c' },
- ],
- },
- // 侧导航
- sidebar: {
- active: 0,
- list: [
- { title: '标签一', disabled: false },
- { title: '标签二', disabled: false },
- { title: '标签三', disabled: false },
- ]
- }
- },
- // 侧导航选择
- sidebarChange: function (e) {
- const that = this;
- that.setData({ 'sidebar.active': e.detail })
- },
- // 跳转菜单
- tabPath(e) {
- let { route } = e.detail.detail;
- if (route) wx.redirectTo({ url: `/${route}` })
- },
- // 返回上一页
- back: function () {
- wx.navigateBack({ delta: 1 })
- },
- // 上传图片
- imgUpl: function (e) {
- const that = this;
- let data = that.data.img_url;
- data.push(e.detail)
- that.setData({ img_url: data })
- },
- // 删除图片
- imgDel: function (e) {
- const that = this;
- let list = that.data.img_url;
- let arr = list.filter((i, index) => index != e.detail.index)
- that.setData({ img_url: arr })
- },
- // 打开弹框
- toDialog: function () {
- const that = this;
- that.setData({ dialog: { title: '弹框标题', show: true, type: '1' } })
- },
- // 关闭弹框
- toClose: function () {
- const that = this;
- that.setData({ dialog: { title: '弹框标题', show: false, type: '1' } })
- },
- // 选项卡
- tabsChange: function (e) {
- const that = this;
- that.setData({ 'tabs.active': e.detail.name });
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- const that = this;
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|