zoukankan      html  css  js  c++  java
  • new webpack.ProvidePlugin vue模块化的全局引用

    目前在vue-cli2运用

    webpack.base.conf.js

    new webpack.ProvidePlugin({
          jQuery: 'jquery',
          $: 'jquery',
          Gdata: ['@/api/index.js', 'default'],
          RequestApi: resolve('/static/config/index.js')
        })
    static/config/index.js
    const peconfig = 'devCompXs';
    switch (peconfig) {
      case 'devPloce':
        var DUTY_URL_INTERNET = '//10.95.1.210:10021';
        var WEBSOCKET_INTERNET = 'ws://10.95.1.210:10021/commonwebsocket/channels/test';
        var MAPCONTROL_SOCKET_INTERNET = 'ws://10.95.1.210:10021/websocket/mapControl/127.0.0.1'; //这条目前没有业务用注释着
        var VIDEO_SOCKET_INTERNET = 'ws://10.95.1.210:10021/websocket/vidoControl/127.0.0.1';
        var MESSAGE_SOCKET_INTERNET = 'ws://10.95.1.210:10021/websocket/message/127.0.0.1'; //这条目前没有业务用注释着
        //其他资源
        var MAP_URL_INTERNET = 'http://114.215.146.210:25003/v3/tile?z={z}&x={x}&y={y}';
        var TRAFFIC_URL_INTERNET =
          'https://api.mapbox.com/styles/v1/banterise/cjhvkka84004g2rpn9cw8ng90/tiles/256/{z}/{x}/{y}@2x?access_token=pk.eyJ1IjoiYmFudGVyaXNlIiwiYSI6ImNpaXNrNzRidjAzOGZ2NG01d3ozcmt6cW4ifQ.V--rLvOufK9nTJdRoAm_Pw';
    
        var VIDEOWPZ = 'http://10.168.31.222/download/VideoWebPlugin.exe';
        var MAPCONFIG_INTERNET = {
          center: [34.2778, 108.953098],
          zoom: 13
        };
        break;
      case 'devCompBd':
        var DUTY_URL_INTERNET = '//10.168.31.96:10021';
        var WEBSOCKET_INTERNET = 'ws://10.168.31.96:10021/commonwebsocket/channels/test';
        var MAPCONTROL_SOCKET_INTERNET = 'ws://10.168.31.96:10021/websocket/mapControl/127.0.0.1';
        var VIDEO_SOCKET_INTERNET = 'ws://10.168.31.96:10021/websocket/vidoControl/127.0.0.1';
        var MESSAGE_SOCKET_INTERNET = 'ws://10.168.31.96:10021/websocket/message/127.0.0.1';
        //其他资源
        var MAP_URL_INTERNET = 'http://114.215.146.210:25003/v3/tile?z={z}&x={x}&y={y}';
        var TRAFFIC_URL_INTERNET =
          'https://api.mapbox.com/styles/v1/banterise/cjhvkka84004g2rpn9cw8ng90/tiles/256/{z}/{x}/{y}@2x?access_token=pk.eyJ1IjoiYmFudGVyaXNlIiwiYSI6ImNpaXNrNzRidjAzOGZ2NG01d3ozcmt6cW4ifQ.V--rLvOufK9nTJdRoAm_Pw';
    
        var VIDEOWPZ = 'http://10.168.31.222/download/VideoWebPlugin.exe';
        var MAPCONFIG_INTERNET = {
          center: [34.2778, 108.953098],
          zoom: 13
        };
        break;
      case 'devCompXs':
        var DUTY_URL_INTERNET = '//10.168.31.3:9111';
        var WEBSOCKET_INTERNET = 'ws://10.168.31.3:9111/commonwebsocket/channels/test';
        var MAPCONTROL_SOCKET_INTERNET = 'ws://10.168.31.3:9111/websocket/mapControl/127.0.0.1';
        var VIDEO_SOCKET_INTERNET = 'ws://10.168.31.3:9111/websocket/vidoControl/127.0.0.1';
        var MESSAGE_SOCKET_INTERNET = 'ws://10.168.31.3:9111/websocket/message/127.0.0.1';
        //其他资源
        var MAP_URL_INTERNET = 'http://114.215.146.210:25003/v3/tile?z={z}&x={x}&y={y}';
        var TRAFFIC_URL_INTERNET =
          'https://api.mapbox.com/styles/v1/banterise/cjhvkka84004g2rpn9cw8ng90/tiles/256/{z}/{x}/{y}@2x?access_token=pk.eyJ1IjoiYmFudGVyaXNlIiwiYSI6ImNpaXNrNzRidjAzOGZ2NG01d3ozcmt6cW4ifQ.V--rLvOufK9nTJdRoAm_Pw';
    
        var VIDEOWPZ = 'http://10.168.31.222/download/VideoWebPlugin.exe';
        var MAPCONFIG_INTERNET = {
          center: [34.2778, 108.953098],
          zoom: 13
        };
        break;
      case 'production':
        var DUTY_URL_INTERNET = '//10.95.1.120:10011'; //服务地址
        var WEBSOCKET_INTERNET = 'ws://10.95.1.120:10011/commonwebsocket/channels/test'; //实车socket
        var MAPCONTROL_SOCKET_INTERNET = 'ws://10.95.1.120:10011/websocket/mapControl/127.0.0.1';
        var VIDEO_SOCKET_INTERNET = 'ws://10.95.1.120:10011/websocket/vidoControl/127.0.0.1'; //4分屏前三个socket
        var MESSAGE_SOCKET_INTERNET = 'ws://10.95.1.120:10011/websocket/message/127.0.0.1';
        var VIDEOWPZ = 'http://10.95.1.120:9111/VideoWebPlugin.exe'; //下载视频资源
    
        var TRAFFIC_URL_INTERNET = 'http://114.215.146.210:25003/v3/tile?z={z}&x={x}&y={y}';
        var MAP_URL_INTERNET = 'http://10.95.1.104/xian/m/{z}/{x}/{y}.png';
    
        var MAPCONFIG_INTERNET = {
          center: [34.2778, 108.953098],
          zoom: 13
        };
        break;
    }
    
    export {
      DUTY_URL_INTERNET, // 配置服务器地址,
      WEBSOCKET_INTERNET,
      MAPCONTROL_SOCKET_INTERNET,
      VIDEO_SOCKET_INTERNET,
      MESSAGE_SOCKET_INTERNET,
      MAP_URL_INTERNET,
      TRAFFIC_URL_INTERNET,
      VIDEOWPZ,
      MAPCONFIG_INTERNET
    };
    View Code
  • 相关阅读:
    iOS-字符串的连接
    [Win32]Win32 SDK编程系列文章——键盘输入消息
    [置顶] eclipse导入svn下载的项目后无法与服务器的svn项目关联
    iOS-时区 日期处理
    数学之路(3)数据分析(5)
    Filter解决中文乱码问题
    Mac OS X 10.8.3搭建Android工程源码的编译环境(解决找不到GCC、GIT、PYTHON的问题)
    paypal租用
    Java通过内部类实现回调功能
    处理9path图片边缘的小黑点
  • 原文地址:https://www.cnblogs.com/lsc-boke/p/11739032.html
Copyright © 2011-2022 走看看