feat: support version option (#23)
* feat: support version option * docs(README): added version option
This commit is contained in:
@@ -384,6 +384,10 @@ wx.chooseImage({
|
||||
|
||||
```[不建议使用]``` 设置用户票据的值
|
||||
|
||||
### .version
|
||||
|
||||
获取 weRequest 版本号
|
||||
|
||||
## FAQ
|
||||
|
||||
### 我希望在请求时候,页面能出现最简单的loading状态,该怎么办?
|
||||
|
||||
1
build/interface.d.ts
vendored
1
build/interface.d.ts
vendored
@@ -72,4 +72,5 @@ export interface weRequest {
|
||||
getConfig?: () => IGetConfigResult;
|
||||
login?: (callback: Function) => void;
|
||||
setSession?: (x: string) => void;
|
||||
version?: string;
|
||||
}
|
||||
|
||||
2
build/version.d.ts
vendored
Normal file
2
build/version.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare const version: string;
|
||||
export { version };
|
||||
File diff suppressed because one or more lines are too long
2
build/weRequest.min.js
vendored
2
build/weRequest.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -6,6 +6,7 @@ import login from "./api/login"
|
||||
import getSession from "./api/getSession"
|
||||
import getConfig from "./api/getConfig"
|
||||
import { weRequest } from "./interface"
|
||||
import { version } from './version'
|
||||
|
||||
const weRequestObject: weRequest = {
|
||||
init,
|
||||
@@ -14,7 +15,8 @@ const weRequestObject: weRequest = {
|
||||
setSession,
|
||||
login,
|
||||
getSession,
|
||||
getConfig
|
||||
getConfig,
|
||||
version
|
||||
};
|
||||
|
||||
export default weRequestObject;
|
||||
|
||||
@@ -152,4 +152,6 @@ export interface weRequest {
|
||||
login?: (callback: Function) => void;
|
||||
/* [不建议使用] 设置用户票据的值 */
|
||||
setSession?: (x: string) => void;
|
||||
/* 获取weRequest版本 */
|
||||
version?: string;
|
||||
}
|
||||
|
||||
5
src/version.ts
Normal file
5
src/version.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
declare const __VERSION__: string;
|
||||
|
||||
const version = __VERSION__;
|
||||
|
||||
export { version };
|
||||
@@ -26,6 +26,9 @@ module.exports = [
|
||||
libraryExport: "default"
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
__VERSION__: JSON.stringify(pk.version)
|
||||
}),
|
||||
new webpack.BannerPlugin({
|
||||
banner: `weRequest ${pk.version}\n${pk.homepage}`
|
||||
})
|
||||
@@ -55,6 +58,9 @@ module.exports = [
|
||||
},
|
||||
devtool: "inline-source-map",
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
__VERSION__: JSON.stringify(pk.version)
|
||||
}),
|
||||
new webpack.BannerPlugin({
|
||||
banner: `weRequest ${pk.version}\n${pk.homepage}`
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user