sykj 0.0.6 → 0.0.7
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/lib/focus.ts +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/directives/dataType.ts +0 -34
package/lib/focus.ts
CHANGED
|
@@ -5,11 +5,11 @@ const globalKey = window.$sy.key;
|
|
|
5
5
|
|
|
6
6
|
let st: number | null = null;
|
|
7
7
|
document.addEventListener("focusin", (event) => {
|
|
8
|
-
clearTimeout(st as number | undefined);
|
|
9
8
|
if (
|
|
10
9
|
(event.target as HTMLElement)?.tagName === "INPUT" ||
|
|
11
10
|
(event.target as HTMLElement)?.tagName === "TEXTAREA"
|
|
12
11
|
) {
|
|
12
|
+
clearTimeout(st as number | undefined);
|
|
13
13
|
globalKey.open();
|
|
14
14
|
globalKey.currentElement = event.target;
|
|
15
15
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* <input/> 专用
|
|
3
|
-
* 使用 v-dataType 指令
|
|
4
|
-
* 需要额外在input中定义blur事件
|
|
5
|
-
* ** = key.currentElement.value (**双向绑定属性
|
|
6
|
-
* 最终形态
|
|
7
|
-
* <input v-dataType v-model="text" @blur="text = key.currentElement.value" />
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { useKeyStore } from "sykj/packages/keyboard/src/key_pinia";
|
|
11
|
-
import type { VueElement } from "vue";
|
|
12
|
-
|
|
13
|
-
const dataType = {
|
|
14
|
-
mounted(el:any, binding: any, vnode: VueElement) {
|
|
15
|
-
const key = useKeyStore()
|
|
16
|
-
const type = el.type
|
|
17
|
-
if (type != "password" && type != 'textarea') {
|
|
18
|
-
el.type = "text"
|
|
19
|
-
}
|
|
20
|
-
if (el.tagName != 'INPUT') {
|
|
21
|
-
console.warn("Cannot bind elements other than ’input‘");
|
|
22
|
-
}
|
|
23
|
-
el.addEventListener('focus', function () {
|
|
24
|
-
key.keyboardcon = true
|
|
25
|
-
key.currentElement = el
|
|
26
|
-
key.inputType = type || 'text'
|
|
27
|
-
})
|
|
28
|
-
el.addEventListener('blur', function () {
|
|
29
|
-
key.keyboardcon = false
|
|
30
|
-
})
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export default dataType;
|