1.安装依赖 npm install x2js 2.在入口函数中引入并挂载到原型 import x2js from 'x2js' Vue.prototype.$x2js = new x2js() 3.使用方法 //xml转json this.$x2js.xml2js() //json转xml this.$x2js.js2xml()