mp reset
This commit is contained in:
parent
a32b72452e
commit
b526b00c2b
|
|
@ -2,6 +2,7 @@
|
||||||
"component": true,
|
"component": true,
|
||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"t-button": "../../../miniprogram_npm/tdesign/button/button",
|
"t-button": "../../../miniprogram_npm/tdesign/button/button",
|
||||||
"t-popup": "../../../miniprogram_npm/tdesign/popup/popup"
|
"t-popup": "../../../miniprogram_npm/tdesign/popup/popup",
|
||||||
|
"t-dialog": "../../../miniprogram_npm/tdesign/dialog/dialog"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
export default OakComponent({
|
export default OakComponent({
|
||||||
data: {
|
data: {
|
||||||
visible: false,
|
visible: false,
|
||||||
|
|
@ -26,5 +27,33 @@ export default OakComponent({
|
||||||
onVisibleChange(e: any) {
|
onVisibleChange(e: any) {
|
||||||
this.setVisible(e.detail.visible);
|
this.setVisible(e.detail.visible);
|
||||||
},
|
},
|
||||||
|
//小程序重置
|
||||||
|
handleReset() {
|
||||||
|
this.resetInitialData();
|
||||||
|
const pages = getCurrentPages(); //获取加载的页面
|
||||||
|
const currentPage = pages[pages.length - 1]; //获取当前页面的对象
|
||||||
|
const url = currentPage.route; //当前页面url
|
||||||
|
const options = currentPage.options; //如果要获取url中所带的参数可以查看options
|
||||||
|
this.redirectTo(
|
||||||
|
{
|
||||||
|
url: url
|
||||||
|
.replace('/pages', '')
|
||||||
|
.replace('pages', '')
|
||||||
|
.replace('/index', ''),
|
||||||
|
},
|
||||||
|
options
|
||||||
|
);
|
||||||
|
this.closeDialog();
|
||||||
|
},
|
||||||
|
showDialog() {
|
||||||
|
this.setState({
|
||||||
|
dialogVisible: true,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
closeDialog() {
|
||||||
|
this.setState({
|
||||||
|
dialogVisible: false,
|
||||||
|
});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@
|
||||||
<t-button bind:tap="printRunningTree" t-class="btn-item" theme="primary" size="small" shape="circle">R</t-button>
|
<t-button bind:tap="printRunningTree" t-class="btn-item" theme="primary" size="small" shape="circle">R</t-button>
|
||||||
<t-button bind:tap="printDebugStore" t-class="btn-item" theme="primary" size="small" shape="circle">S</t-button>
|
<t-button bind:tap="printDebugStore" t-class="btn-item" theme="primary" size="small" shape="circle">S</t-button>
|
||||||
<t-button bind:tap="printCachedStore" t-class="btn-item" theme="primary" size="small" shape="circle">C</t-button>
|
<t-button bind:tap="printCachedStore" t-class="btn-item" theme="primary" size="small" shape="circle">C</t-button>
|
||||||
|
<t-button bind:tap="showDialog" t-class="btn-item" theme="danger" size="small" shape="circle">Reset</t-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</t-popup>
|
</t-popup>
|
||||||
|
<t-dialog visible="{{dialogVisible}}" title="重置数据" content="重置后,原来的数据不可恢复" cancel-btn="取消" confirm-btn="确定" bind:cancel="closeDialog" bind:confirm="handleReset" />
|
||||||
Loading…
Reference in New Issue