如何使用 vuejs 服务器端读取 xml 文件内容?
How to read xml file content with vuejs Server side?
我需要读取存储在服务器端特定路径中的 xml 文件。我正在使用 VueJS,但我不能使用 JQUERY...你能帮我吗有什么想法或建议吗?
案例:
1. 文件将存储在/static/label/custom-label.xml
2.我需要读取服务器端的这个文件并加载contect。
3.我会使用const中加载的内容。
不确定您使用的后端是什么,但它被标记为 JS,所以我假设 Node/Express。如果我错了请纠正我。
使用快速中间件来定义您的路径。如果您在服务器上存储资产以供 public 使用,请将它们存储在您的 /public/
文件夹中。
app.use('/static', express.static('public'));
app.use(express.static('files'));
使用/static/
路由获取静态资源
http://localhost:3000/static/foobar.jpg
https://expressjs.com/en/starter/static-files.html
这个 SO post 可能会有所帮助:
我需要读取存储在服务器端特定路径中的 xml 文件。我正在使用 VueJS,但我不能使用 JQUERY...你能帮我吗有什么想法或建议吗?
案例: 1. 文件将存储在/static/label/custom-label.xml 2.我需要读取服务器端的这个文件并加载contect。 3.我会使用const中加载的内容。
不确定您使用的后端是什么,但它被标记为 JS,所以我假设 Node/Express。如果我错了请纠正我。
使用快速中间件来定义您的路径。如果您在服务器上存储资产以供 public 使用,请将它们存储在您的 /public/
文件夹中。
app.use('/static', express.static('public'));
app.use(express.static('files'));
使用/static/
路由获取静态资源
http://localhost:3000/static/foobar.jpg
https://expressjs.com/en/starter/static-files.html
这个 SO post 可能会有所帮助: