1***@qq.com
1***@qq.com
  • 发布:2019-09-20 09:41
  • 更新:2021-04-12 15:14
  • 阅读:715

打包andorid后vuex失效

分类:uni-app
import {mapState,mapMutations} from 'vuex'  
import {LOCK} from '../../store/modules/actionType.js'  
computed:{  
            ...mapState('common',['lock'])  
        },  
...mapMutations('common',[LOCK]),  
async login(){  
                               if(this.lock) return  
                let reslut = this.checkTel() &&  this.checkPas()   
                if(!reslut) return  
                                 this.Lock()  
                let data={  
                    username:this.tel,  
                    password:this.pas,  
                }  
                let res = await request(url.login,data,'post')  
                uni.showToast({  
                    icon:'none',  
                    title:res.message  
                })  
                uni.setStorageSync('timestamp',res.data.timestamp)  
                uni.setStorageSync('token',res.data.token)  
                let timer=setTimeout(()=>{  
                    clearTimeout(timer)  
                    uni.redirectTo({  
                        url:'/pages/index/index'  
                    })  
                },1500)  
            },
import {LOCK,UNLOCK} from'./actionType.js'  
const common = {  
    state:{  
        lock:false  
    },  
    mutations:{  
        [LOCK](state){  
            state.lock=true  
        },  
        [UNLOCK](state){  
            state.lock=false  
        },  
    },  
    actions:{  
        [LOCK]({commit}){  
            commit(LOCK)  
        },  
        [UNLOCK]({commit}){  
            commit(UNLOCK)  
        },  
    }  
}  
export default {  
    namespaced:true,  
    ...common  
}  
2019-09-20 09:41 负责人:无 分享
已邀请:
3***@qq.com

3***@qq.com

解决了吗?我在HbuilderX更新到3.1.8时失效的,不清楚是什么地方配置有问题...

该问题目前已经被锁定, 无法添加新回复