sykj 0.1.8 → 0.1.9

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/common.ts CHANGED
@@ -2,11 +2,15 @@ import "./store";
2
2
  import "./focus";
3
3
 
4
4
  import SyKeyboard from "../packages/keyboard/index.ts"; // 引入封装好的组件
5
- import {
6
- Loading1 as SyLoading1,
7
- Loading2 as SyLoading2,
8
- } from "../packages/loading/index.ts"; // 引入封装好的组件
5
+ // import * as SyLoading from "../packages/loading/index.ts"; // 引入封装好的组件
6
+ import { SyLoading } from "../packages/loading/index.ts"; // 一键导出所有组件
7
+
8
+ const a = () => {
9
+ console.log(123);
10
+ };
9
11
 
10
12
  // 使用命名导出
11
13
  export { SyKeyboard as default };
12
- export { SyLoading1, SyLoading2 };
14
+ export { SyLoading };
15
+
16
+ export { a };
package/lib/focus.ts CHANGED
@@ -16,23 +16,19 @@ document.addEventListener("focusin", (event) => {
16
16
  });
17
17
 
18
18
  document.addEventListener("focusout", (event) => {
19
- globalKey.close();
20
-
21
- // st = setTimeout(() => {
22
- // // globalKey.currentElement = null;
23
- // }, 100);
24
- // const target = event.target as HTMLElement;
25
- // if (target?.tagName === "INPUT" || target?.tagName === "TEXTAREA") {
26
- // // window.showKeyboard()
27
- // //
28
- // }
19
+ const target = event.target as HTMLElement;
20
+ if (target?.tagName === "INPUT" || target?.tagName === "TEXTAREA") {
21
+ if (!isEditableFormComponent(target)) return;
22
+ globalKey.close();
23
+ }
29
24
  });
30
25
 
31
26
  // 是否展示输入法
32
27
  const isEditableFormComponent = (el: HTMLElement): boolean => {
28
+ // 类型守卫
33
29
  const notType: Array<string> = ["checkbox", "radio"];
34
30
  if (!(el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement))
35
- return false; // 类型守卫
31
+ return false;
36
32
  if (el.readOnly || notType.includes(el.type)) {
37
33
  return false;
38
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sykj",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "rem adaptation🚀",
5
5
  "main": "lib/common.ts",
6
6
  "files": [
@@ -26,6 +26,7 @@
26
26
  "amfe-flexible": "^2.2.1",
27
27
  "axios": "^1.6.8",
28
28
  "element-plus": "^2.7.2",
29
+ "lottie-web": "^5.12.2",
29
30
  "pinia": "^2.1.7",
30
31
  "vitepress": "^1.3.1",
31
32
  "vue": "^3.4.21",
@@ -1,5 +1,5 @@
1
1
  import SyKeyboard from "./src/Keyboardcon.vue";
2
- import { App } from "vue";
2
+ import type { App } from "vue";
3
3
  /* istanbul ignore next */
4
4
  SyKeyboard.install = function (Vue: App) {
5
5
  Vue.component(SyKeyboard.name, SyKeyboard);
@@ -1,12 +1,12 @@
1
1
  import Loading1 from "./Loading1.vue";
2
2
  import Loading2 from "./Loading2.vue";
3
- import { App } from "vue";
3
+ import SyLoading from "./index.vue";
4
4
 
5
5
  // 导出具体的组件
6
- export { Loading1, Loading2 };
6
+ export { SyLoading };
7
7
 
8
- // 安装函数
9
- export function install(Vue: App) {
10
- Vue.component(Loading1.name, Loading1);
11
- Vue.component(Loading2.name, Loading2);
12
- }
8
+ // // 安装函数
9
+ // export function install(Vue: App) {
10
+ // Vue.component(Loading1.name, Loading1);
11
+ // Vue.component(Loading2.name, Loading2);
12
+ // }
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <div class="SyLoading">
3
+ <component :is="loadingType" />
4
+ </div>
5
+ </template>
6
+
7
+ <script setup>
8
+ import { computed } from "vue";
9
+ import SyLoading1 from "./Loading1.vue";
10
+ import SyLoading2 from "./Loading2.vue";
11
+
12
+ // 定义 props
13
+ const props = defineProps({
14
+ type: {
15
+ type: [String, Number],
16
+ default: 1, // 默认组件类型
17
+ },
18
+ });
19
+
20
+ // 组件映射表
21
+ const loadingComponents = {
22
+ 1: SyLoading1,
23
+ 2: SyLoading2,
24
+ };
25
+
26
+ // 根据 props 动态确定渲染的组件
27
+ const loadingType = computed(() => {
28
+ return loadingComponents[props.type] || SyLoading1; // 默认返回 SyLoading1
29
+ });
30
+ </script>
31
+
32
+ <style lang="scss" scoped>
33
+ .SyLoading {
34
+ display: inline-block;
35
+ .loadAni {
36
+ pointer-events: none;
37
+ }
38
+ }
39
+ </style>