aoscici2000
V2EX  ›  Vue.js

Vue 如何显示指定文件夹图片等文件

  •  
  •   aoscici2000 · Mar 23, 2019 · 3274 views
    This topic created in 2691 days ago, the information mentioned may be changed or developed.

    如题, 因为学习中直接使用了以前的一些文件和数据, 大量图片存储在 /media/...目录下, 跟静态资源文件夹是独立开的, 怎么设置才能在 dev 运行时候能正常显示这些文件?

    3 replies    2019-03-23 01:51:38 +08:00
    noe132
        1
    noe132  
       Mar 23, 2019
    Vue 只是个前端框架。。。。
    读文件的事情请找后台服务程序
    rabbbit
        2
    rabbbit  
       Mar 23, 2019
    另起一个 express 服务, 然后配置 proxy 转发
    例如
    ```
    module.exports = {
    devServer: {
    proxy: {
    '/api': {
    target: 'http://localhost:3000'
    }
    }
    }
    };
    ```
    rabbbit
        3
    rabbbit  
       Mar 23, 2019
    补充 楼上指的是 vue-cli
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1093 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 18:23 · PVG 02:23 · LAX 11:23 · JFK 14:23
    ♥ Do have faith in what you're doing.