方法封装以及调用
需要创建一个util的文件夹 在里面创建一个.JS后缀的文件,里面放好自己定义的方法,使用export或者 使用export default 抛出,区别在于
1、export的对外接口有多个,而export default对外接口只能有一个,所以export default定义了多个方法,需要用对象的方法导出。
2、export在其他页面引入 import {export} from ‘./export’
export default在其他页面引入 import export from ‘./export’
3、假如是封装接口
使用了promise方法,则需要 在接收的地方使用 .then