【发布时间】:2019-02-26 20:54:27
【问题描述】:
我需要读取存储在服务器端特定路径中的 xml 文件。我正在使用 VueJS,但我无法使用 JQUERY……你能帮我一些想法或建议吗?
案例: 1.文件将存储在/static/label/custom-label.xml 2.我需要读取服务器端的这个文件并加载contect。 3.我将使用一个const加载的内容。
【问题讨论】:
-
好的,我找到了一种快速解决问题的方法
getLabelXml() { let result = null; const xmlhttp = new XMLHttpRequest(); xmlhttp.open('GET', '/label/paciente.label', false); xmlhttp.send(); if (xmlhttp.status === 200) { result = xmlhttp.responseText; } return result; }
标签: javascript xml vue.js filereader