vue3.x + vite2.x + vant + element-plus H5移动端低代码平台 lowcode 可视化拖拽 可视化编辑器 visual editor 类似易企秀的H5制作、建站工具、可视化搭建工具
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

27 lines
659 B

/**
* @name: useGlobalProperties
* @author: 卜启缘
* @date: 2021/5/3 21:13
* @description:useGlobalProperties
* @update: 2021/5/3 21:13
*/
import { getCurrentInstance } from 'vue'
import { RouteLocationNormalizedLoaded, Router } from 'vue-router'
interface GlobalProperties {
$$refs: any
$route: RouteLocationNormalizedLoaded
$router: Router
}
export const useGlobalProperties = () => {
const globalProperties = getCurrentInstance()!.appContext.config
.globalProperties as GlobalProperties
const registerRef = (el, _vid: string) => el && (globalProperties.$$refs[_vid] = el)
return {
globalProperties,
registerRef
}
}