export 与 utils 方法书写规范
1. export 命令
export const firstName = 'Michael';
export const lastName = 'Jackson';
export const year = 1958;
// 等价于
const firstName = 'Michael';
const lastName = 'Jackson';
const year = 1958;
export { firstName, lastName, year }; // 优先考虑这种方式,写在文件尾部可以清晰看到输出了哪些接口export function multiply(x, y) {
return x * y;
};2. import 命令
3. 整体加载
4. export default 命令
5. Utils 推荐写法
Last updated