Vue.js 引入外部js方法


 1、外部文件config.js

第一种写法

//常量的定义

const config = {
  baseurl:'http://172.16.114.5:8088/MGT2'
}

//函数的定义

function formatXml(text) {
  return text
}

//导出 {常量名、函数名}
export {config,formatXml}

第二种写法

//常量的定义

export const config = {
  baseurl:'http://172.16.114.5:8088/MGT2'
}

//函数的定义

export function formatXml(text) {
  return text
}

2、引入config.js里面的常量和方法

  import {config,formatXml} from '../config'//记得带上{}花括号

 

 



					


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM