赞
踩
- import { ComponentInternalInstance, getCurrentInstance } from 'vue';
- // 添加断言
- export default function useCurrentInstance(){
- const { appContext } = getCurrentInstance() as ComponentInternalInstance;
- const proxy =appContext.config.globalProperties;
- return { proxy }
- }
- import { ElMessage } form "elementPlus"
- app.config.globalProperties.$message = ElMessage;
- import useCurrentInstance from "../useCurrentInstance";
- const { proxy } = useCurrentInstance();
- proxy.$message({type:"warning",message:"请输入密码"})
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。