zoukankan      html  css  js  c++  java
  • vue 全局注册组件

    // Globally register all base components for convenience, because they
    // will be used very frequently. Components are registered using the
    // PascalCased version of their file name.
    
    import Vue from 'vue'
    
    // https://webpack.js.org/guides/dependency-management/#require-context
    const requireComponent = require.context(
      // Look for files in the current directory
      '.',
      // Do not look in subdirectories
      false,
      // Only include "_base-" prefixed .vue files
      /.vue$/
    )
    
    // For each matching file name...
    requireComponent.keys().forEach((fileName) => {
      // Get the component config
      const componentConfig = requireComponent(fileName)
      // Get the PascalCase version of the component name
      const componentName = fileName
    
      .split('/')
            .pop()
            .replace(/.w+$/, '')
        // // Remove the "./_" from the beginning
        // .replace(/^./_/, '')
        // // Remove the file extension from the end
        // .replace(/.w+$/, '')
        // // Split up kebabs
        // .split('-')
        // // Upper case
        // .map((kebab) => kebab.charAt(0).toUpperCase() + kebab.slice(1))
        // // Concatenated
        // .join('')
    
      // Globally register the component
      console.log(componentName)
      Vue.component(componentName, componentConfig.default || componentConfig)
    })
    import Vue from "vue";
    import router from "./router";
    import ElementUI from "element-ui"
    import 'element-ui/lib/theme-chalk/index.css';
    
    import App from "./App.vue";
    
    import "@/components/all.js"
    
    Vue.use(ElementUI)
    
    Vue.config.productionTip = false;
    
    new Vue({
      router,
      render: h => h(App)
    }).$mount("#app");
  • 相关阅读:
    【Postgresql】set up
    【LSTM】Understanding-LSTMs
    【CTR】各公司方法
    【DL】stanford--cs20si--tensorflow
    Redis数据库入门教程
    用.htaccess文件实现URL重写
    php中urldecode()和urlencode()
    php中序列化与反序列化
    网站整合Ucenter详细流程
    ucenter 整合外部网站,实现登录等操作
  • 原文地址:https://www.cnblogs.com/Jiaojiawang/p/12853703.html
Copyright © 2011-2022 走看看