aoscici2000
V2EX  ›  Vue.js

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

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

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

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