网站的优势和劣势,软件网站排名,logo高清图片,wordpress百度熊掌号文章目录 一、概念二、实践2.1、定义2.2、使用 三、最后 一、概念
一个用于注册能够被应用内所有组件实例访问到的全局属性的对象。点击【前往】访问官网 二、实践
2.1、定义
在main.ts文件中设置app.config.globalPropertie
import {createApp} from vue
import ElementPl… 文章目录 一、概念二、实践2.1、定义2.2、使用 三、最后 一、概念
一个用于注册能够被应用内所有组件实例访问到的全局属性的对象。点击【前往】访问官网 二、实践
2.1、定义
在main.ts文件中设置app.config.globalPropertie
import {createApp} from vue
import ElementPlus from element-plus;
import element-plus/dist/index.css
import App from ./App.vue
import router from ./router
import Pagination from /components/Pagination/index.vue;const app createApp(App);//全局方法
app.config.globalProperties.$type 类型;app.component(Pagination, Pagination)
app.use(router);
app.use(ElementPlus);
app.mount(#app);2.2、使用
在Vue文件中使用getCurrentInstance()通过proxy.$type就可以调用上面定义的方法
templateel-input v-modelproxy.$type /
templatescript setup
import { getCurrentInstance } from vue;
const { proxy } getCurrentInstance();
console.log(proxy.$type)
/script三、最后
本人每篇文章都是一字一句码出来希望对大家有所帮助多提提意见。顺手来个三连击点赞收藏关注✨一起加油☕