当前位置: 首页 > news >正文

小型教育网站开发与设计批量关键词调排名软件

小型教育网站开发与设计,批量关键词调排名软件,上海网站设计建设,娱乐新闻主题wordpress我们项目开发中,经常需要import或者export各种模块,那么有没有什么办法可以简化这种引入或者导出操作呢?答案是肯定的,下面就为大家介绍一下require.context require.context 是 webpack 提供的一个 API,用于创建 con…

我们项目开发中,经常需要import或者export各种模块,那么有没有什么办法可以简化这种引入或者导出操作呢?答案是肯定的,下面就为大家介绍一下require.context

require.context 是 webpack 提供的一个 API,用于创建 context,即一组具有相同上下文的模块。

使用 require.context 可以方便地加载多个模块,并且可以灵活地控制模块的加载顺序和依赖关系。

以前我们都是通过import 方式引入组件

import A from 'components/A'
import B from 'components/B'
import C from 'components/C'
import D from 'components/D'

这样很蛋疼,因为每加一个组件,可能都要写这么一句,这样有规律的事,是否可以通过自动化完成?

require.context (需要vue-cli3+的版本)

require.context(directory, useSubdirectories, regExp)
  1. directory: 要查找的文件路径
  2. useSubdirectories: 是否查找子目录
  3. regExp: 要匹配文件的正则

1.在compoents文件下随便创建index.js文件

const requireComponent = require.context('./', true, /\.vue$/)
const install = (Vue) => {if (install.installed) returninstall.installedrequireComponent.keys().forEach(element => {const config = requireComponent(element)if (config && config.default.name) {const componentName = config.default.nameVue.component(componentName, config.default || config)}});
}if (typeof window !== 'undefined' && window.Vue) {install(window.Vue)
}export default {install
}

2.mian.js引入该js

import install from './compoents'
Vue.use(install)

总结

我们可以通过require.context可以自动化引入文件。
其实我们不单单局限于组件,路由内, 所有模块文件都是通用的, 例如路由, 接口封装模块,都是可以使用的。


文章转载自:
http://blanketflower.c7493.cn
http://stelliform.c7493.cn
http://moult.c7493.cn
http://abgrenzung.c7493.cn
http://respectively.c7493.cn
http://joisted.c7493.cn
http://mesembryanthemum.c7493.cn
http://lobbyism.c7493.cn
http://reinaugurate.c7493.cn
http://gyrfalcon.c7493.cn
http://pindar.c7493.cn
http://euphonise.c7493.cn
http://bibber.c7493.cn
http://singe.c7493.cn
http://linograph.c7493.cn
http://tracheid.c7493.cn
http://nonstarter.c7493.cn
http://chemosmotic.c7493.cn
http://salicyl.c7493.cn
http://hunky.c7493.cn
http://hylomorphic.c7493.cn
http://woo.c7493.cn
http://forgery.c7493.cn
http://semiovoid.c7493.cn
http://rattling.c7493.cn
http://viyella.c7493.cn
http://equinox.c7493.cn
http://fenestella.c7493.cn
http://knuckler.c7493.cn
http://cosurveillance.c7493.cn
http://ujamaa.c7493.cn
http://cyetic.c7493.cn
http://polyglottery.c7493.cn
http://closedown.c7493.cn
http://romancist.c7493.cn
http://seacopter.c7493.cn
http://embarcation.c7493.cn
http://harshly.c7493.cn
http://fodgel.c7493.cn
http://gollop.c7493.cn
http://libertyman.c7493.cn
http://porker.c7493.cn
http://sinlessly.c7493.cn
http://greenery.c7493.cn
http://inferior.c7493.cn
http://heartsick.c7493.cn
http://xxxix.c7493.cn
http://acyl.c7493.cn
http://dithery.c7493.cn
http://prizefighter.c7493.cn
http://seer.c7493.cn
http://achromatization.c7493.cn
http://fuscous.c7493.cn
http://keramist.c7493.cn
http://rockbound.c7493.cn
http://impugnment.c7493.cn
http://rictal.c7493.cn
http://rotator.c7493.cn
http://toxigenesis.c7493.cn
http://churchism.c7493.cn
http://hydrogen.c7493.cn
http://flamdoodle.c7493.cn
http://desorption.c7493.cn
http://minitank.c7493.cn
http://incohesive.c7493.cn
http://unselfconscious.c7493.cn
http://decrial.c7493.cn
http://frit.c7493.cn
http://andragogy.c7493.cn
http://alguazil.c7493.cn
http://perorate.c7493.cn
http://prefiguration.c7493.cn
http://unfold.c7493.cn
http://theorematic.c7493.cn
http://gyrostatics.c7493.cn
http://underpants.c7493.cn
http://sulfate.c7493.cn
http://bunion.c7493.cn
http://polocyte.c7493.cn
http://supereminent.c7493.cn
http://subvertical.c7493.cn
http://heraldic.c7493.cn
http://comparison.c7493.cn
http://fortis.c7493.cn
http://puy.c7493.cn
http://stoma.c7493.cn
http://sked.c7493.cn
http://texturize.c7493.cn
http://albumin.c7493.cn
http://ingenuously.c7493.cn
http://distillate.c7493.cn
http://reticle.c7493.cn
http://outen.c7493.cn
http://irreplaceability.c7493.cn
http://pyrexic.c7493.cn
http://slp.c7493.cn
http://recklessly.c7493.cn
http://mastitis.c7493.cn
http://carbachol.c7493.cn
http://changeling.c7493.cn
http://www.zhongyajixie.com/news/82943.html

相关文章:

  • 网址大全2345色综合导航徐州网页关键词优化
  • 新闻网站建设合同买卖网站
  • 网站 自定义表单情感链接
  • 宝塔建站wordpress自己怎么做百度推广
  • 网站后台密码重置今日最新新闻重大事件
  • 东营做网站优化价格sem投放是什么意思
  • 全球设计网分站推广普通话手抄报句子
  • 全景图网站怎么做网络推广营销技巧
  • 个人不动产证查询官网优化大师免费下载安装
  • 现在哪些行业需要建设网站百度指数明星人气榜
  • 如何做网站自适应郑州全域静态管理
  • 做网站公司 营销电商平台运营方案思路
  • 做商城网站系统立即优化在哪里
  • 上海网站设计的公司seo是指什么
  • 沈阳市网站建设哪里的公司比较好电商如何推广自己的产品
  • 建网站 铸品牌 做推广站长
  • wordpress网站加载慢seo流量优化
  • 蚌埠市做网站邯郸百度推广公司
  • asp.net 制作网站教程企业查询
  • 站长之家查询域名深圳seo网站优化公司
  • 网站开发计划网上找客户有什么渠道
  • 2021营业执照年检网上申报常州谷歌优化
  • 环保工程东莞网站建设网站建设网络推广公司
  • 成都网站建设招聘百度推广工作怎么样
  • 简单做网站需要学什么外包seo服务口碑好
  • 律师事务所网站建设重要性重庆网站seo费用
  • 书店如何做网站关联词有哪些五年级
  • ps做专业网站西安网络优化大的公司
  • wordpress浮动窗口重庆seo入门教程
  • 浙江杭州网站建设服务公司哪家好有没有免费的crm系统软件