-import { reactive, ref } from "vue";
+import { reactive, ref, provide, nextTick, onMounted } from "vue";
import areaList from "./areaList.vue";
+import { useRoute, useRouter } from "vue-router";
+import mitt from "@/utils/mitt";
const info = reactive({
- address: '泸县'
+ address: '泸县',
+ pinyin: 'luxian'
})
+const areaListRef = ref(null);
+
// 选择镇
const choseArea = ref(null)
const open = () => {
- choseArea.value = !choseArea.value;
+ areaListRef.value.show();
}
// 关闭
const offAreaList = (e) => {
+ Object.keys(e).forEach(key => {
+ if (e[key]) {
+ info[key] = e[key];
+ }
+ })
info.address = e.name;
+ mitt.emit('map_info', info);
}
+
+const router = useRouter()
+const route = useRoute()
+
+const navToDelivery = () => {
+ if (route.path == '/') router.push('/delivery');
+ else router.back();
+}
+
+onMounted(() => {
+ mitt.emit('map_info', info);
+})