diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..8355daf
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,13 @@
+# These are supported funding model platforms
+
+github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
+patreon: # Replace with a single Patreon username
+open_collective: # Replace with a single Open Collective username
+ko_fi: # Replace with a single Ko-fi username
+tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
+community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
+liberapay: # Replace with a single Liberapay username
+issuehunt: # Replace with a single IssueHunt username
+otechie: # Replace with a single Otechie username
+lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
+custom: ['https://raw.githubusercontent.com/javaLuo/javaLuo/master/pay.png'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
diff --git a/README.md b/README.md
index 58da586..380b5ef 100644
--- a/README.md
+++ b/README.md
@@ -125,6 +125,9 @@ export default {
- 模态框的显示和隐藏完全由父级控制,所以用户通过验证后,需要手动隐藏模态框
### 更新日志
+2022/12/01 - 1.1.10
+- 修复:修复了一个在判定过程中关闭模态框导致reset失效的问题
+
2021/10/18 - 1.1.9
- 修复:修复了在判定状态还未刷新时关闭模态框,重新打开不刷新的问题
diff --git a/README3.md b/README3.md
index 4847170..7c46628 100644
--- a/README3.md
+++ b/README3.md
@@ -1,13 +1,11 @@
# vue3-puzzle-vcode [](https://www.npmjs.com/package/vue3-puzzle-vcode) [](https://www.npmjs.com/package/vue3-puzzle-vcode)
-以下是在Vue3.x中使用的文档
-
**DEMO**: https://isluo.com/work/vue-puzzle-vcode/

-### Vue3.x 安装 vue3-puzzle-vcode
+### 安装 vue3-puzzle-vcode
```node
npm install vue3-puzzle-vcode --save
@@ -20,36 +18,23 @@
-
```
@@ -58,6 +43,7 @@ export default {
| 字段 | 类型 | 默认值 | 说明 |
| ------------ | ------- | ------------------ | ----------------------------------------------------------------------------- |
| show | Boolean | false | 是否显示验证码弹框 |
+| type | String | "modal" | "modal"模态框模式/"inside"内嵌模式 |
| canvasWidth | Number | 310 | 主图区域的宽度,单位 px |
| canvasHeight | Number | 160 | 主图区域的高度,单位 px |
| puzzleScale | Number | 1 | 拼图块(小的拼图)的大小比例,0.2 ~ 2 ,数字越大,拼图越大 |
@@ -67,6 +53,7 @@ export default {
| successText | String | "验证通过!" | 验证成功时的提示文字 |
| failText | String | "验证失败,请重试" | 验证失败时的提示文字 |
| sliderText | String | "拖动滑块完成拼图" | 下方滑动条里的文字 |
+| className | String | "" | 给根元素一个class类用于自定义样式 |
### 事件
@@ -75,7 +62,17 @@ export default {
| success | 偏差值 | 验证通过时会触发,返回值是用户移动的距离跟目标距离的偏差值 px |
| fail | 偏差值 | 验证失败时会触发,返回值同上 |
| close | null | 用户点击遮罩层的回调 |
-
+| reset | null | 用户手动点击右上角刷新按钮时的回调 |
+
+success事件 / fail事件 会返回两个参数 :
+```javascript
+ deviation: number, // 偏差值,用户滑动的位置 和 拼图缺口所在位置 的距离,单位px
+ obj: {
+ deviation: number, // 同 deviation
+ offsetX: number, // 用户滑动的距离,单位px
+ pinX: number, // 拼图缺口的所在位置(相对canvas的左边缘), 单位px
+ }
+```
### 自定义图片
```vue
@@ -83,28 +80,77 @@ export default {
-
```
+### 内嵌模式
+```vue
+
+
+
+
+
+
+
+```
+内嵌模式下,需要自己处理容器样式。
+
+### 手动刷新
+每当`:show="isShow"` isShow等于true时,会自动刷新一次内部状态
+你也可以手动刷新:
+```vue
+
+
+
+```
+
### 说明
- 当不传递 imgs 字段或图片加载出错时,会自动生成随机图片
- 模态框的显示和隐藏完全由父级控制,所以用户通过验证后,需要手动隐藏模态框
+### Nuxt3: 如果你使用Nuxt3发现样式出现问题,请使用以下专用版本试试
+```node
+ npm install vue3-puzzle-vcode@1.1.6-nuxt --save
+```
+
+- 为什么要这样?
+`Nuxt3`打包服务器端代码使用了`Nitro`库,这个库打包时不知为何无法识别相对路径的CSS代码,因此为Nuxt3专门制作了一个版本
+以后每次发布新的版本时,都会同时发布一个专用于`Nuxt`的版本,后缀为`-nuxt`;
+
### 更新日志
+2024/01/25 - 1.1.7
+- 更新: 增加了success/fail事件的返参
+- 优化:现在不会出现正方形的拼图块
+
+2023/01/03 - 1.1.6
+- 新增: 拼图块现在会呈现随机形状
+
+2023/01/02 - 1.1.5
+- 新增: 内嵌模式
+
+2022/12/01 - 1.0.7
+- 修复: 修复了一个在判定中关闭模态框可能会导致reset失效的问题
+
+2022/06/02 - 1.0.6
+- 更新:支持TypeScript
+- 修复:修复了因vue版本不同导致的报错问题
+
2021/10/18 - 1.0.4
- 修复:修复了在判定状态还未刷新时关闭模态框,重新打开不刷新的问题
@@ -117,4 +163,4 @@ export default {
2021/10/12 - 1.0.1
- 修复:重复加载图片的问题
- 修复:png图片的透明部分现在会用白色填充
-- 更新:初始化时不再自动加载图片,直到show出来时再加载
\ No newline at end of file
+- 更新:初始化时不再自动加载图片,直到show出来时再加载
diff --git a/package.json b/package.json
index 09c3333..32668bc 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "vue-puzzle-vcode",
- "version": "1.1.9",
+ "version": "1.1.10",
"description": "vue 滑动拼图验证码",
"main": "dist/main.js",
"files": [
@@ -67,4 +67,4 @@
"> 1%",
"not dead"
]
-}
+}
\ No newline at end of file
diff --git a/src/app.vue b/src/app.vue
index 9d7f202..8652dd8 100644
--- a/src/app.vue
+++ b/src/app.vue
@@ -207,7 +207,7 @@ export default {
methods: {
// 关闭
onClose() {
- if (!this.mouseDown) {
+ if (!this.mouseDown && !this.isSubmting) {
clearTimeout(this.timer1);
this.$emit("close");
}