mp-weixin-back 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +25 -0
- package/.prettierrc.js +8 -0
- package/client.d.ts +19 -0
- package/dist/index.d.mts +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +72376 -0
- package/dist/index.mjs +72366 -0
- package/package.json +49 -0
- package/readme.md +75 -0
- package/src/context.ts +54 -0
- package/src/index.ts +47 -0
- package/test/data/index.vue +13 -0
- package/test/generate.spec.ts +14 -0
- package/tsconfig.json +15 -0
- package/tsup.config.ts +15 -0
- package/types/index.ts +35 -0
- package/utils/constant.ts +2 -0
- package/utils/index.ts +159 -0
- package/vite.config.ts +10 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
root = true
|
|
3
|
+
|
|
4
|
+
[*]
|
|
5
|
+
indent_style = space
|
|
6
|
+
# 缩进大小=2
|
|
7
|
+
indent_size = 2
|
|
8
|
+
|
|
9
|
+
end_of_line = lf
|
|
10
|
+
# 字符集=utf-8
|
|
11
|
+
charset = utf-8
|
|
12
|
+
# 删除行尾空格 = 是
|
|
13
|
+
trim_trailing_whitespace = true
|
|
14
|
+
# 插入最后一行=真
|
|
15
|
+
insert_final_newline = true
|
|
16
|
+
|
|
17
|
+
[*.md]
|
|
18
|
+
# 删除行尾空格 = 否
|
|
19
|
+
trim_trailing_whitespace = false
|
|
20
|
+
|
|
21
|
+
[package.json]
|
|
22
|
+
# 缩进样式=空格
|
|
23
|
+
indent_style = space
|
|
24
|
+
# 缩进大小=2
|
|
25
|
+
indent_size = 2
|
package/.prettierrc.js
ADDED
package/client.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare module 'mp-weixin-back-helper' {
|
|
2
|
+
type Config = {
|
|
3
|
+
/**
|
|
4
|
+
* 是否阻止默认的回退事件,默认为 false
|
|
5
|
+
*/
|
|
6
|
+
preventDefault: boolean
|
|
7
|
+
/**
|
|
8
|
+
* 阻止次数,默认是 `1`
|
|
9
|
+
*/
|
|
10
|
+
frequency: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function onPageBack(
|
|
14
|
+
callback:() => void,
|
|
15
|
+
params: Partial<Config>
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
export default onPageBack
|
|
19
|
+
}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
|
|
3
|
+
type UserOptions = Partial<Config>;
|
|
4
|
+
type Config = {
|
|
5
|
+
/**
|
|
6
|
+
* 是否阻止默认的回退事件,默认为 false
|
|
7
|
+
*/
|
|
8
|
+
preventDefault: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 阻止次数,默认是 `1`
|
|
11
|
+
*/
|
|
12
|
+
frequency: number;
|
|
13
|
+
/**
|
|
14
|
+
* 页面回退时触发
|
|
15
|
+
*/
|
|
16
|
+
onPageBack?: (params: BackParams) => void;
|
|
17
|
+
};
|
|
18
|
+
type BackParams = {
|
|
19
|
+
/**
|
|
20
|
+
* 当前页面路径
|
|
21
|
+
*/
|
|
22
|
+
page: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
declare function MpBackPlugin(userOptions?: UserOptions): Plugin;
|
|
26
|
+
|
|
27
|
+
export { MpBackPlugin as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
|
|
3
|
+
type UserOptions = Partial<Config>;
|
|
4
|
+
type Config = {
|
|
5
|
+
/**
|
|
6
|
+
* 是否阻止默认的回退事件,默认为 false
|
|
7
|
+
*/
|
|
8
|
+
preventDefault: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 阻止次数,默认是 `1`
|
|
11
|
+
*/
|
|
12
|
+
frequency: number;
|
|
13
|
+
/**
|
|
14
|
+
* 页面回退时触发
|
|
15
|
+
*/
|
|
16
|
+
onPageBack?: (params: BackParams) => void;
|
|
17
|
+
};
|
|
18
|
+
type BackParams = {
|
|
19
|
+
/**
|
|
20
|
+
* 当前页面路径
|
|
21
|
+
*/
|
|
22
|
+
page: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
declare function MpBackPlugin(userOptions?: UserOptions): Plugin;
|
|
26
|
+
|
|
27
|
+
export { MpBackPlugin as default };
|