• vscode 配置网址


    首先我的项目是一个面向医院的系统
    我是在三个文件里都配置了网址

    第一个文件:vue.config.js

    1. const path = require('path')
    2. const webpack = require('webpack')
    3. const createThemeColorReplacerPlugin = require('./config/plugin.config')
    4. function resolve (dir) {
    5. return path.join(__dirname, dir)
    6. }
    7. const vueConfig = {
    8. publicPath: '/dist',
    9. configureWebpack: {
    10. plugins: [
    11. new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
    12. ],
    13. externals: {}
    14. },
    15. chainWebpack: (config) => {
    16. config.resolve.alias
    17. .set('@$', resolve('src'))
    18. const svgRule = config.module.rule('svg')
    19. svgRule.uses.clear()
    20. svgRule
    21. .oneOf('inline')
    22. .resourceQuery(/inline/)
    23. .use('vue-svg-icon-loader')
    24. .loader('vue-svg-icon-loader')
    25. .end()
    26. .end()
    27. .oneOf('external')
    28. .use('file-loader')
    29. .loader('file-loader')
    30. .options({
    31. name: 'assets/[name].[hash:8].[ext]'
    32. })
    33. },
    34. css: {
    35. loaderOptions: {
    36. less: {
    37. javascriptEnabled: true
    38. }
    39. }
    40. },
    41. devServer: {
    42. port: 8000,
    43. proxy: {
    44. '/admin': {
    45. // target: 'http://压缩的网址:端口号',
    46. target: 'http://正常调试的网址:端口号',
    47. ws: false,
    48. changeOrigin: true
    49. }
    50. }
    51. },
    52. productionSourceMap: false,
    53. transpileDependencies: [],
    54. runtimeCompiler: true
    55. }
    56. if (process.env.VUE_APP_PREVIEW === 'true') {
    57. console.log('VUE_APP_PREVIEW', true)
    58. vueConfig.configureWebpack.plugins.push(createThemeColorReplacerPlugin())
    59. }
    60. module.exports = vueConfig

    这个文件里最重要的代码是

    1. devServer: {
    2. port: 8000,
    3. proxy: {
    4. '/admin': {
    5. // target: 'http://压缩网址:端口号',
    6. target: 'http://正常网址:端口号',
    7. ws: false,
    8. changeOrigin: true
    9. }
    10. }
    11. },

    第二个出现的地方 是根据自己需要 因为我用到了视频通话 需要建立连接

    1. // 建立socket及rtc
    2. onsocket () {
    3. if ('WebSocket' in window) {
    4. const onlyKey = moment().valueOf() + '_pc'
    5. // 生产环境
    6. // const url = window.location.hostname + ':8080' + '/websocket?Bedno=' + onlyKey
    7. // this.ws = new WebSocket('ws://' + url)
    8. // 开发环境
    9. this.ws = new WebSocket('ws://网址:端口号/websocket?Bedno=' + onlyKey)
    10. this.socket.setWs(this.ws)
    11. } else {
    12. this.$message.info('您的浏览器不支持websocket')
    13. }
    14. this.ws.onmessage = this.onmessage
    15. this.ws.onopen = this.onopen
    16. this.ws.onerror = this.onerror
    17. this.ws.onclose = this.onclose
    18. },

    所以小伙伴在实际运用中,需要用到视频通话,记得需要建立socket!!

    第三个出现的地方是 需要用到文件上传 所以在mounted里也需要加上

    1. mounted () {
    2. // 生产环境
    3. // this.originUrl = window.location.protocol + '//' + window.location.host + '/files/'
    4. // 开发环境=
    5. this.originUrl = 'http://网址:端口号/files/'
    6. this.getfilelist()
    7. }

     友情提示:小伙伴根据自己的实际需要,去增加、删除网址出现的地方!!!

  • 相关阅读:
    Linux面试题2:网络IO模型 & IO多路复用
    用Node.js开发基于稳定扩散的AI应用
    Revit二次开发 创建空心模型并与指定构件剪切
    SpringBoot+PDF.js实现按需分片加载预览(包含可运行示例源码)
    鸿蒙开发工具的汉化
    (五)C++中的排序函数性能比较
    看了我的 RPC 实战,同事拍案叫绝
    【运维日常】infiniband网络架构,容器间跨机器不同网段通信
    3.3 Windows驱动开发:内核MDL读写进程内存
    React闭包
  • 原文地址:https://blog.csdn.net/weixin_63199745/article/details/132987487