factory_mp_old/components/loading/index.vue

44 lines
717 B
Vue
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script>
//映射vuex中控制loading显示隐藏的状态到此组件
import { mapState } from "vuex";
export default {
data() {
return {
show: false,
};
},
computed: {
...mapState(["loadingState"]),
},
watch: {
// 监听vuex中的loadingState变化
loadingState(newVal, oldVal) {
if (newVal) {
this.open();
} else {
this.close();
}
// console.log(newVal, oldVal, "监听到loadingState变化");
},
},
methods: {
open() {
this.show = true;
},
close() {
this.show = false;
},
},
};
</script>
<script>
//显示加载框
uni.showLoading({
title: '加载中'
});
</script>
<style>
</style>