UNPKG

fastchar-appjs

Version:

快速搭建VUE项目工具类的基本库,主要用于每个功能页面独立生成html,不使用vue单页面功能。

250 lines (249 loc) 7.56 kB
/** * 项目相关操作 * @author Janesen */ export declare class System { /** * 项目标题 */ static projectTitle: string; /** * 项目的全局配置对象,将会自动生成到base.html中 */ static projectGlobalConfig: any; /** * 获取默认的vue配置文件 * @param dirName 项目根目录,建议取值 {@link __dirname} * @param options 更多选项配置 {@link BuildOption} */ static getDefaultVueConfig(dirName: string, options?: BuildOption): any; /** * 是否是 vue-cli-service build 命令构建模式 */ static isVueCliServerBuild(): boolean; /** * 是否是 vue-cli-service server 命令构建模式 */ static isVueCliServerServer(): boolean; /** * 是否是正式版本,production */ static isProduction(): boolean; /** * 是否的打包开发版本,development */ static isDevelopment(): boolean; /** * 是否的打包测试版本,test */ static isVueTest(): boolean; /** * 获取运行脚本 npm_lifecycle_script 里的参数值,例如:--model production 参数名:--model 参数值:production * @param argument */ static getScriptArgumentValue(argument: string): string | null; /** * 获取命令参数 --client 或 --client-strict 的值 */ static getServiceClient(): string; /** * 是否使用了命令参数 --client-strict */ static isServiceClientStrict(): boolean; /** * 获取命令参数 --debug 的值 */ static isServiceDebug(): boolean; /** * 获取打包支持的支付方式,避免ios上架失败,不允许支付宝支付等功能 */ static getServicePay(): string[]; /** * 设置全局变量值 * @param key 变量名 * @param data 变量值 */ static setGlobalConfig(key: string, data: any): void; /** * 设置FastServer请求接口的全局默认参数 * @param data 参数对象 */ static setFinalParams(data: any): void; /** * 彻底删除指定目录文件 * @param path */ static removeFile(path: any): void; } /** * 页面相关操作 */ export declare class Pages { /** * 第三方插件存放目录文件夹,默认:node_modules */ static nodeModulesDir: string; /** * vue页面的相对目录文件夹,默认:src/pages/ */ static pagesDir: string; /** * 入口文件名,默认:index.js */ static mainFileName: string; /** * 页面的默认配置json,按照vue的格式配置即可 */ static configFileName: string; /** * 入口文件的模板名称,默认:index.html */ static templateFileName: string; /** * 获取vue页面配置,vue.config.js 中的pages配置 * @param dirName 项目的根目录 * @param options 更多配置 */ static getBuildPages(dirName: string, options?: BuildOption): any; /** * 创建默认的index索引页面 * @param pagesValue * @param dirName * @param options */ static createIndexPage(pagesValue: string, dirName: string, options?: BuildOption): any; /** * 快速复制一个vue子页面开发 * @param dirName 项目根目录 * @param copyPageName 复制目标的文件夹名 * @param newPageName 新生成的文件夹名 */ static copyPage(dirName: string, copyPageName: string, newPageName: string): void; } /** * 全局注入脚本插件 */ export declare class FastInjectJsPlugin { private readonly options; constructor(options: any); filter(key: string, targetFilter: any): boolean; injectArray(local: any, entry: any, targetInjectJsFiles: any): void; injectObject(local: any, entry: any, targetInjectJsFiles: any): void; apply(compiler: any): void; } /** * 获取编译配置的选项配置,配置选项如下: * <br/> * {@link projectTitle } 项目名称 * <br/> * {@link createConfigFile } 是否在每个页面目录下自动创建config.json文件 * <br/> * {@link createIndexPage } 是否自动创建项目的index页面 * <br/> * {@link globalConfig } 系统的全局配置 * <br/> * {@link finalParams } FastServer请求接口全局请求参数,web项目的全局参数优先级大于原生APP的全局参数 * <br/> * {@link injectJsFiles } 所有页面全局注入的js文件 * <br/> * {@link injectJsFilter } 所有页面全局注入js文件过滤器 * <br/> * {@link injectVariable } 所有页面全局注入js变量 * <br/> * {@link cacheVueLoader } 是否使用vue默认的cache-loader,默认使用 */ export declare class BuildOption { /** * 项目名称 */ projectTitle: string | undefined; /** * 是否在每个页面目录下自动创建config.json文件 */ createConfigFile: boolean; /** * 是否自动创建项目的index页面 */ createIndexPage: boolean; /** * 系统的全局配置 * @example * globalConfig:{ * mainUrl:"http://192.168.0.1:8080/test" * } */ globalConfig: object | undefined; /** * FastServer请求接口全局请求参数。Web项目的全局参数优先级大于原生APP的全局参数 * @example * finalParams:{ * userId:2, * userName:undefined //当配置undefined值时,将排除此参数属性名 * } */ finalParams: object | undefined; /** * 所有页面全局注入的js文件 * @example * injectJsFiles:["src/js/test.js","src/js/icon.js"] * 或 * injectJsFiles:{ * "src/js/test.js":{ * exclude:["user","set"] //排除注入页面的名称,例如:user.html,set.html * }, * "src/js/icon.js":{ * include:["user","set"] //指定注入页面的名称,例如:user.html,set.html * } * } * 或 * injectJsFiles:[ * "src/js/test.js", * { * "src/js/icon.js":{ * exclude:["user","set"] //排除注入页面的名称,例如:user.html,set.html * } * } * ] */ injectJsFiles: string[] | object | undefined; /** * 所有页面全局注入js文件过滤器,当 {@link injectJsFiles} 为数组时生效! * @example * injectJsFilter:{ * include:["user","set"] //指定注入页面的名称,例如:user.html,set.html * } * 或 * injectJsFilter:{ * exclude:["user","set"] //排除注入页面的名称,例如:user.html,set.html * } */ injectJsFilter: { /** * 包含指定的页面,例如:user.html,set.html 则传入["user","set"] */ include?: string[]; /** * 排除指定页面,例如:user.html,set.html 则传入["user","set"] */ exclude?: string[]; } | undefined; /** * 所有页面全局js变量注入 * @example * injectVariable:{ * getUserId:function(){ * return 1; * }, * server:"……" * } */ injectVariable: any | undefined; /** * 是否使用vue默认的cache-loader缓存vue-loader,如果不使用,则在build版本前将删除缓存的目录.cache/vue-loader */ cacheVueLoader: boolean; /** * 是否强制检测配置客户端 --client 编译完全匹配 */ clientStrict: boolean; }