vue 一个js文件内export 多个function, 内部function互调使用
vue 一个js文件内export 多个function, 内部function互调使用index.jsimport { getBytesLength as sss } from "@/utils/index";// sss 为别名//面包屑名称限制export function reSetNameBreadcrumb(name, lengthArr){console.log(sss("xxx")
·
vue 一个js文件内export 多个function, 内部function互调使用
方法一、
index.js
import { getBytesLength as sss } from "@/utils/index"; // sss 为别名
export function reSetNameBreadcrumb(name, lengthArr){
console.log(sss("xxx")) // 调用内部方法
}
export function getBytesLength (str) {
return str
}
调用方式:
import { reSetNameBreadcrumb } from "@/utils/index";
reSetNameBreadcrumb("", "")
方法二、
test.js
function test1(str) {
test2(str);
}
function test2(str) {
console.warn(str);
}
export default {
test1,
test2
};
调用方式:
import ccc from "@/utils/test";
ccc.test1("xxxxxx");
更多推荐
已为社区贡献6条内容
所有评论(0)