123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- const app = getApp()
- Page({
- data: {
- initParams: null
- },
- handleChange(e) {
- let { obj } = e.target.dataset;
- let value = e.detail.value;
- this.data[obj] = value;
- },
- saveCongfig() {
- try {
- app.data.initParams = JSON.parse(this.data.initParams);
- } catch (error) {
- my.showToast({
- type: 'fail',
- content: 'JSON格式有误',
- duration: 1500,
- });
- return;
- }
- my.showToast({
- type: 'success',
- content: '保存成功',
- duration: 1500,
- });
- my.navigateBack(1)
- },
- resetConfig() {
- app.data.initParams = my.getStorageSync({key: "defaultInitParams"}).data;
- this.update();
- my.showToast({
- type: 'success',
- content: '恢复成功',
- duration: 1500,
- });
- my.navigateBack(1)
- },
- update() {
- this.setData({
- initParams: JSON.stringify(app.data.initParams),
- })
- },
- onLoad() {
- this.update();
- },
- });
|