123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- // pagesCommon/test/index.js
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- form: {
- imgList: []
- },
- // 弹框
- dialog: { title: '弹框标题', show: false, type: '1' },
- // 日期时间选择
- dateform: {},
- // 选项卡
- tabs: {
- active: 'a',
- menu: [
- { title: '选项卡一', active: 'a' },
- { title: '选项卡二', active: 'b' },
- { title: '选项卡三', active: 'c' },
- { title: '选项卡四', active: 'd' },
- { title: '选项卡五', active: 'e' },
- ],
- },
- // 富文本
- content: ''
- },
- // 上传图片
- imgUpl: function (e) {
- const that = this;
- let data = that.data.form[e.detail.name];
- data.push(e.detail.data)
- that.setData({ [`form.${e.detail.name}`]: data })
- },
- // 删除图片
- imgDel: function (e) {
- const that = this;
- let data = that.data.form[e.detail.name];
- let arr = data.filter((i, index) => index != e.detail.data.index)
- that.setData({ [`form.${e.detail.name}`]: 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' } })
- },
- // 日期时间选择
- datetimeChange: function (e) {
- const that = this;
- that.setData({ [`dateform.${e.detail.name}`]: e.detail.datetime });
- },
- // 选择选项卡
- tabsChange: function (e) {
- const that = this;
- const { title, active } = e.detail;
- that.setData({ 'tabs.active': active });
- },
- // 监听富文本输入
- bindInput: function (e) {
- const that = this;
- const { html, text, name } = e.detail;
- that.setData({ [`${name}`]: html })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|