qiu-Ann

 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\'//记得带上{}花括号

 

 

分类:

技术点:

相关文章:

  • 2022-01-05
  • 2021-08-02
  • 2021-09-29
  • 2021-08-02
  • 2021-12-13
  • 2021-11-21
  • 2021-09-23
猜你喜欢
  • 2021-12-13
  • 2021-12-13
  • 2021-08-02
  • 2021-12-08
  • 2021-08-02
  • 2021-12-08
相关资源
相似解决方案