由于uview2.0取消了等待时间后出现等待框
使用vuex实现
//store/index.js
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
state: {
timer: null
},
mutations: {
// 设置定时器
setTimer(state) {
uni.hideLoading()
clearTimeout(state.timer)
state.timer = null
state.timer = setTimeout(() => {
uni.