vue的导入

import { onMounted, onUpdated, onUnmounted } from ‘vue’;

  1. 单一导出(不使用 {}):通常用于导入vue组件
    当一个模块只导出一个内容时,可以直接导入,无需使用 {}。
  2. 多个导出(使用 {}):通常用于导入函数
    当一个模块导出多个内容时,需要使用 {} 来指定导入的内容。
import { onMounted, onUpdated, onUnmounted } from 'vue';
import { createRouter, createWebHistory } from 'vue-router';
import { createPinia } from 'pinia';
// customDirective.js
export const myDirective = {
  // ...
};
// 在其他文件中导入
import { myDirective } from './customDirective.js';