动态路由
vue2
const fn = require.context('./views', true, /.vue$/)
const paths = fn.keys()// 说有views下面.vue结尾文件,路径字符串,数组形式
路由懒加载import参数不能是字符串,可以是模板字符串,半写死
vue3
const modules = import.meta.glob('../views/*/*.vue')//获取所有vue组件
路由懒加载import参数不能是字符串,可以是模板字符串,半写死
浙公网安备 33010602011771号