1234567891011121314151617181920212223242526272829 |
- import { onLoad } from '@dcloudio/uni-app'
- import { get } from "@/http/http.js"
- import { useLoginUserStore } from '@/stores/loginUser'
- const loginUserStore = useLoginUserStore()
- export function useSetTitle() {
- /**
- * 设置标题
- */
- function setTitle(){
- console.log(loginUserStore.loginUser.sysName)
- if(loginUserStore.loginUser.sysName){
- uni.setNavigationBarTitle({
- title: loginUserStore.loginUser.sysName //页面标题为页面顶部显示的文字
- });
- }else{
- get("/auth/getSysNameAndLogo").then(res => {
- let sysName = res.sysName || '';
- loginUserStore.setLoginUserTitle(sysName)
- uni.setNavigationBarTitle({
- title: sysName //页面标题为页面顶部显示的文字
- });
- })
- }
- }
- onLoad(() => {
- setTitle();
- })
- }
|