123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <template>
- <view></view>
- </template>
- <script>
- import store from "@/store";
- export default {
- data() {
- return {
- show: false
- }
- },
- computed: {
- statusValue() {
- return store.state.networkErrorInfo.networkError
- }
- },
- watch: {
- statusValue(newVal, oldVal) {
- console.log('value changed========:', newVal, oldVal)
- if (newVal == '1'&&!this.show) {
- const that = this
- uni.showModal({
- title: '提示',
- content: '网络异常,请重试',
- showCancel: false,
- confirmText: '刷新',
- success: function(res) {
- store.commit("networkErrorInfo/setStatus", '0');
- that.show = true
-
- if (res.confirm) {
- that.show = false
- that.$emit('refreshAll')
- } else if (res.cancel) {
- that.show = false
- that.$emit('refreshAll')
- console.log('用户点击取消');
- }
- }
- });
- } else {
- that.show = false
- }
- }
- },
- mounted() {
- store.commit("networkErrorInfo/setStatus", '0');
- }
- }
- </script>
- <style scoped lang="scss">
- </style>
|