feat: 首页侧边抽屉调整
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, defineEmits } from "vue";
|
||||
import { ref, defineEmits, defineExpose } from "vue";
|
||||
import { getLoginUserPhone } from "@/request/api/LoginApi";
|
||||
import { NOTICE_EVENT_LOGOUT } from "@/constant/constant";
|
||||
import { useAppStore } from "@/store";
|
||||
@@ -64,11 +64,6 @@ const menuList = ref([
|
||||
// { label: "订阅消息", type: "action", action: "subscribeMessage" },
|
||||
]);
|
||||
|
||||
// 组件挂载时调用
|
||||
onMounted(() => {
|
||||
getLoginUserPhoneInfo();
|
||||
});
|
||||
|
||||
const getLoginUserPhoneInfo = async () => {
|
||||
const res = await getLoginUserPhone();
|
||||
|
||||
@@ -113,6 +108,8 @@ const handleLogout = () => {
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
defineExpose({ getLoginUserPhoneInfo });
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -12,19 +12,26 @@
|
||||
<text class="title">我的</text>
|
||||
</view>
|
||||
|
||||
<MineSetting @close="close" />
|
||||
<MineSetting ref="mineSettingRef" @close="close" />
|
||||
</view>
|
||||
</uni-drawer>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, defineExpose } from "vue";
|
||||
import { checkToken } from "@/hooks/useGoLogin";
|
||||
import MineSetting from "./components/MineSetting/index.vue";
|
||||
|
||||
const drawerRef = ref(null);
|
||||
|
||||
// 监听抽屉显示事件
|
||||
const open = () => drawerRef.value.open();
|
||||
const mineSettingRef = ref(null);
|
||||
const open = () => {
|
||||
checkToken().then(async () => {
|
||||
await mineSettingRef.value.getLoginUserPhoneInfo();
|
||||
drawerRef.value.open();
|
||||
});
|
||||
};
|
||||
|
||||
// 监听抽屉隐藏事件
|
||||
const close = () => drawerRef.value.close();
|
||||
|
||||
Reference in New Issue
Block a user