App.vue
1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<script setup>
import {onMounted, ref} from 'vue';
import {onShow} from '@dcloudio/uni-app';
import {useStore} from 'vuex';
// ------定义变量------
const store = useStore(); //vuex获取储存数据
const locationData = ref({});
// ------生命周期------
onShow(()=>{
// 获取当前位置储存在vuex,获取取件、派件列表时要用到
uni.getLocation({
type: 'wgs84',
success: res => {
locationData.value = {
longitude: res.longitude,
latitude: res.latitude
};
store.commit('user/setlLacation', locationData.value);
},
fail: err => {
}
});
uni.getNetworkType({
success: function(res) {
}
});
})
onMounted(() => {
});
</script>
<style lang="scss">
@import '@/uni_modules/uni-scss/index.scss';
</style>
<style lang="scss">
/*每个页面公共css */
/* #ifndef APP-NVUE */
@import '@/styles/common.scss';
// 设置整个项目的背景色
page {
background-color: #f5f5f5;
}
/* #endif */
.example-info {
font-size: 14px;
color: #333;
padding: 10px;
}
</style>