// pages/m_user/base_c/c_scene-info/c_scene-info.js import b_inputCheck from '../../behaviors/b_inputCheck' import sceneInfo from '../../../../data/sceneInfo' Component({ behaviors: [b_inputCheck], options: { addGlobalClass: true, }, /** * 组件的属性列表 */ properties: { submitText: { type: String, value: '提交' }, sceneType: { type: String, value: '1' } }, attached() { }, pageLifetimes: { show: function () { // 页面被展示 const info = sceneInfo() this.setData({ msg: info.get(this.data.sceneType) }) }, hide: function () { // 页面被隐藏 }, resize: function (size) { // 页面尺寸变化 } }, /** * 组件的初始数据 */ data: { }, /** * 组件的方法列表 */ methods: { selectChange(e) { const index = e.currentTarget.dataset.index const options = e.detail.options this.setData({ [`msg[${index}].options`]: options }) }, pickerChange(e) { console.log(e); const { index, mode } = e.currentTarget.dataset let i = e.detail.value if (mode == 'region') { this.setData({ [`msg[${index}].value`]: i }) } else if (mode == 'selector') { this.setData({ [`msg[${index}].selectIndex`]: i, [`msg[${index}].value`]: this.data.msg[index].options[i].value }) } } } })