底座全局数据协调

This commit is contained in:
aixianling
2022-03-22 13:46:42 +08:00
parent bc7161c806
commit 11f9119607
4 changed files with 26 additions and 52 deletions

View File

@@ -35,23 +35,22 @@
</div>
</template>
<script>
import {mapMutations} from 'vuex'
import {mapMutations, mapState} from 'vuex'
export default {
name: "home",
data() {
return {
code: '',
token: null,
user: null,
apps: [],
search: ""
}
},
computed: {
...mapState(['user', 'token']),
isApprove() {
return this.user && this.user.status == 2;
return this.user?.status == 2;
},
appsList() {
let {search} = this
@@ -79,10 +78,8 @@ export default {
})
},
getAuth() {
this.token = uni.getStorageSync("token");
this.user = uni.getStorageSync("userInfo");
this.$nextTick(() => {
this.token && this.getUserInfo()
this.getUserInfo()
})
}
},