vue 组件封装

把我们所需要的功能写在一个组件里面     比如 /*popout*/

1:在components里面创建文件夹popout 以及index.js和popout,vue

2:在index,js里面去导出popout.vue

import Popout from "./popout.vue";

export default Popout;

3:在popout里面去写我们所需要的功能

4:在我们所需要的组件里面去引用就行了用impot from '路径'

这样就完成了, 这是最简单的一种静态导入组件方式,
 

猜你喜欢

转载自blog.csdn.net/Poo__Chai/article/details/82110907