lew-ui 1.0.2 → 1.0.3

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.
Files changed (73) hide show
  1. package/.eslintignore +5 -0
  2. package/.eslintrc.js +20 -0
  3. package/README.md +16 -0
  4. package/index.html +18 -0
  5. package/package.json +19 -12
  6. package/{components/base → packages/avatar}/LewAvatar.vue +0 -0
  7. package/packages/avatar/index.ts +9 -0
  8. package/{directives → packages/directives}/index.ts +0 -0
  9. package/{directives → packages/directives}/tooltips.ts +0 -0
  10. package/{hooks → packages/hooks}/index.ts +0 -0
  11. package/{hooks → packages/hooks}/useDOMCreate.ts +0 -0
  12. package/packages/index.ts +17 -0
  13. package/prettier.config.js +38 -0
  14. package/public/favicon.ico +0 -0
  15. package/src/App.vue +251 -0
  16. package/src/assets/logo.png +0 -0
  17. package/src/assets/style/hljs.scss +86 -0
  18. package/src/assets/style/main.scss +87 -0
  19. package/src/assets/style/reset.scss +107 -0
  20. package/src/assets/style/var.scss +90 -0
  21. package/src/components/demo/DemoBox.vue +105 -0
  22. package/src/components/directive/lewTooltips.ts +23 -0
  23. package/{components → src/components}/feedback/LewAlert.vue +0 -0
  24. package/{components → src/components}/feedback/LewMessage.vue +0 -0
  25. package/{components → src/components}/feedback/LewModal.vue +1 -1
  26. package/{components → src/components}/form/LewCheckbox.vue +0 -0
  27. package/{components → src/components}/form/LewCheckboxGroup.vue +1 -1
  28. package/{components/form/FormItem.vue → src/components/form/LewFormItem.vue} +0 -0
  29. package/{components → src/components}/form/LewInput.vue +0 -0
  30. package/{components → src/components}/form/LewRadio.vue +0 -0
  31. package/{components → src/components}/form/LewRadioGroup.vue +1 -1
  32. package/{components → src/components}/form/LewSelect.vue +1 -1
  33. package/{components → src/components}/form/LewSwitch.vue +0 -0
  34. package/{components → src/components}/form/LewTabs.vue +0 -0
  35. package/{components → src/components}/form/LewTextarea.vue +0 -0
  36. package/src/components/general/LewAvatar.vue +107 -0
  37. package/{components/base → src/components/general}/LewBadge.vue +0 -0
  38. package/{components/base → src/components/general}/LewButton.vue +0 -0
  39. package/{components/base → src/components/general}/LewTitle.vue +0 -0
  40. package/src/components/hooks/useDOMCreate.ts +13 -0
  41. package/src/components/index.ts +37 -0
  42. package/src/components/layout/LewSiderbar.vue +98 -0
  43. package/src/env.d.ts +11 -0
  44. package/src/main.ts +22 -0
  45. package/src/router/index.ts +59 -0
  46. package/src/views/demo/feedback/LewAlert.vue +194 -0
  47. package/src/views/demo/feedback/LewDialog.vue +20 -0
  48. package/src/views/demo/feedback/LewMessage.vue +20 -0
  49. package/src/views/demo/feedback/LewModal.vue +127 -0
  50. package/src/views/demo/feedback/LewPopover.vue +20 -0
  51. package/src/views/demo/feedback/LewResult.vue +20 -0
  52. package/src/views/demo/feedback/LewTooltip.vue +164 -0
  53. package/src/views/demo/form/LewCascader.vue +24 -0
  54. package/src/views/demo/form/LewCheckbox.vue +158 -0
  55. package/src/views/demo/form/LewForm.vue +232 -0
  56. package/src/views/demo/form/LewInput.vue +55 -0
  57. package/src/views/demo/form/LewInputTag.vue +25 -0
  58. package/src/views/demo/form/LewRadio.vue +104 -0
  59. package/src/views/demo/form/LewSelect.vue +83 -0
  60. package/src/views/demo/form/LewSwitch.vue +61 -0
  61. package/src/views/demo/form/LewTabs.vue +75 -0
  62. package/src/views/demo/form/LewTextarea.vue +56 -0
  63. package/src/views/demo/general/LewAvatar copy.vue +58 -0
  64. package/src/views/demo/general/LewAvatar.vue +79 -0
  65. package/src/views/demo/general/LewBadge.vue +98 -0
  66. package/src/views/demo/general/LewButton.vue +66 -0
  67. package/src/views/demo/general/LewTitle.vue +47 -0
  68. package/tsconfig.json +18 -0
  69. package/tsconfig.node.json +8 -0
  70. package/vite.config.ts +16 -0
  71. package/vscode.setting.json +26 -0
  72. package/components/index.ts +0 -35
  73. package/index.ts +0 -3
@@ -0,0 +1,107 @@
1
+ body,
2
+ dl,
3
+ dt,
4
+ dd,
5
+ pre,
6
+ form,
7
+ fieldset,
8
+ input,
9
+ p,
10
+ blockquote,
11
+ th,
12
+ td,
13
+ a,
14
+ button,
15
+ select {
16
+ margin: 0;
17
+ padding: 0;
18
+ }
19
+
20
+ h1,
21
+ h2,
22
+ h3,
23
+ h4,
24
+ h4,
25
+ h5 {
26
+ margin: 0;
27
+ padding: 0;
28
+ }
29
+
30
+ select {
31
+ font-size: 14px;
32
+ }
33
+
34
+ table {
35
+ border-collapse: collapse;
36
+ }
37
+
38
+ fieldset,
39
+ img {
40
+ border: 0 none;
41
+ }
42
+
43
+ fieldset {
44
+ margin: 0;
45
+ padding: 0;
46
+ }
47
+
48
+ fieldset p {
49
+ margin: 0;
50
+ padding: 0 0 0 8px;
51
+ }
52
+
53
+ legend {
54
+ display: none;
55
+ }
56
+
57
+ address,
58
+ caption,
59
+ em,
60
+ th,
61
+ i {
62
+ font-style: normal;
63
+ font-weight: 400;
64
+ }
65
+
66
+ table caption {
67
+ margin-left: -var(--border-width);
68
+ }
69
+
70
+ hr {
71
+ border-bottom: var(--border-width) solid #ffffff;
72
+ border-top: var(--border-width) solid #e4e4e4;
73
+ border-width: var(--border-width) 0;
74
+ clear: both;
75
+ height: 2px;
76
+ margin: 5px 0;
77
+ overflow: hidden;
78
+ }
79
+
80
+ ol,
81
+ ul {
82
+ list-style-image: none;
83
+ list-style-position: outside;
84
+ }
85
+
86
+ caption,
87
+ th {
88
+ text-align: left;
89
+ }
90
+
91
+ q:before,
92
+ q:after,
93
+ blockquote:before,
94
+ blockquote:after {
95
+ content: '';
96
+ }
97
+
98
+ a {
99
+ color: #000;
100
+ text-decoration: none;
101
+ position: relative;
102
+ }
103
+
104
+ // 字体设置
105
+ * {
106
+ font-family: 'PingFang SC', DFPKingGothicGB-Regular, sans-serif;
107
+ }
@@ -0,0 +1,90 @@
1
+ :root {
2
+ // 全局
3
+ --body-bgcolor: #fff; // body背景
4
+ --text-color: rgb(51, 54, 57); // 全局文字颜色
5
+ --text-color-invert: rgb(255, 255, 255);
6
+ --border-radius: 8px;
7
+ // 主题色
8
+ --primary-color: rgb(59, 121, 208);
9
+ --primary-color-light: rgb(59, 121, 208, 0.2);
10
+ --primary-text-color: rgb(47, 88, 146);
11
+ --primary-color-hover: rgb(54, 109, 187);
12
+ --primary-color-active: rgb(42, 94, 149);
13
+ //
14
+ --success-color: rgb(49, 196, 141);
15
+ --success-color-dark: rgb(35, 153, 110);
16
+ --success-color-light: rgb(108, 176, 119, 0.2);
17
+ --success-text-color: rgb(30, 107, 41);
18
+ --success-color-hover: rgb(40, 176, 126);
19
+ --success-color-active: rgb(28, 157, 110);
20
+ //
21
+ --danger-color: rgb(249, 128, 128);
22
+ --danger-color-dark: rgb(197, 88, 88);
23
+ --danger-color-light: rgb(249, 128, 128, 0.2);
24
+ --danger-text-color: #d10000;
25
+ --danger-color-hover: rgb(231, 113, 113);
26
+ --danger-color-active: rgb(204, 92, 92);
27
+ //
28
+ --warning-color: rgb(227, 179, 68);
29
+ --warning-color-dark: rgb(186, 132, 7);
30
+ --warning-color-light: rgb(227, 160, 8, 0.2);
31
+ --warning-text-color: rgb(187, 128, 9);
32
+ --warning-color-hover: rgb(211, 150, 8);
33
+ --warning-color-active: rgb(187, 133, 7);
34
+ //
35
+ --normal-color: rgb(236, 235, 235);
36
+ --normal-color-dark: rgb(177, 176, 176);
37
+ --normal-color-light: rgba(154, 154, 154, 0.2);
38
+ --normal-text-color: rgb(66, 66, 66);
39
+ --normal-color-hover: rgb(224, 223, 223);
40
+ --normal-color-active: rgb(165, 161, 161);
41
+ // 标题
42
+ --title-bold: 800;
43
+ --title-color: rgb(33, 33, 33); // 标题颜色
44
+ // 表单样式
45
+ --form-border: 1.5px rgba(0, 0, 0, 0.03) solid;
46
+ --form-border-hover: 1.5px rgba(0, 0, 0, 0.08) solid;
47
+ --form-border-active: 1.5px rgba(0, 0, 0, 0.12) solid;
48
+ --form-border-radius: 8px;
49
+ --form-border-focus: 1.5px solid var(--primary-color);
50
+ --form-bgcolor-focus: rgb(255, 255, 255);
51
+ --form-text-color: #333;
52
+ // 表单背景
53
+ --form-bgcolor: rgba(6, 57, 88, 0.022);
54
+ --form-bgcolor-hover: rgba(6, 57, 88, 0.06);
55
+ --form-bgcolor-active: rgba(6, 57, 88, 0.12);
56
+ // 表单背景2
57
+ --form-bgcolor-high: rgba(6, 57, 88, 0.1);
58
+ --form-bgcolor-high-hover: rgba(6, 57, 88, 0.16);
59
+ --form-bgcolor-high-active: rgba(6, 57, 88, 0.2);
60
+ // 按钮样式
61
+ --button-border-radius: 8px;
62
+ --button-bgcolor: rgba(0, 0, 0, 0.022);
63
+ --button-text-color: #000;
64
+ --button-border: 1px rgba(0, 0, 0, 0.05) solid;
65
+ }
66
+
67
+ .dark {
68
+ // 通用样式
69
+ --border: 1px #eee solid;
70
+ --border-radius: 8px;
71
+ --font-bold: 800;
72
+ // 颜色
73
+ --bgcolor-body: #fff; // body背景
74
+ --color-text: rgb(33, 33, 33); // 全局文字颜色
75
+ --color-title: rgb(33, 33, 33); // 标题颜色
76
+ // 主题色
77
+ --color-primary-1: rgb(30 66 159 / 0.6);
78
+ --color-primary-2: rgb(30 66 159 / 0.8);
79
+ --color-primary-3: rgb(30 66 159 / 1);
80
+ --color-primary-1-hover: rgb(30 66 159 / 0.6);
81
+ --color-primary-2-active: rgb(30 66 159 / 0.8);
82
+ --color-primary-3-foucs: rgb(30 66 159 / 1);
83
+ //
84
+ --color-danger-1: rgb(159, 30, 30, 0.6);
85
+ --color-danger-2: rgb(159, 30, 30, 0.8);
86
+ --color-danger-3: rgb(159, 30, 30, 1);
87
+ --color-danger-1-hover: rgb(159, 30, 30, 0.6);
88
+ --color-danger-2-active: rgb(159, 30, 30, 0.8);
89
+ --color-danger-3-foucs: rgb(159, 30, 30, 1);
90
+ }
@@ -0,0 +1,105 @@
1
+ <script setup lang="ts">
2
+ import { ChevronUp24Regular, Code24Regular } from '@vicons/fluent';
3
+ import { Icon } from '@vicons/utils';
4
+ import { LewTitle, LewBadge } from '../../components';
5
+ import { ref } from 'vue';
6
+ defineProps({
7
+ title: {
8
+ type: String,
9
+ default() {
10
+ return '';
11
+ },
12
+ },
13
+ badge: {
14
+ type: String,
15
+ default() {
16
+ return '';
17
+ },
18
+ },
19
+ code: {
20
+ type: String,
21
+ default() {
22
+ return '';
23
+ },
24
+ },
25
+ });
26
+
27
+ let isShowCode = ref(false);
28
+ </script>
29
+
30
+ <template>
31
+ <div class="demo-box">
32
+ <lew-title size="16px"
33
+ >{{ title }}
34
+ <lew-badge v-if="badge" style="margin: 2px 0px 0px 5px">{{
35
+ badge
36
+ }}</lew-badge>
37
+ </lew-title>
38
+ <div class="demo-item">
39
+ <div class="demo-cp"><slot></slot></div>
40
+ <div v-show="isShowCode" v-highlight class="hl-pre">
41
+ <div class="pre-box">
42
+ <pre><code v-text="code"></code></pre>
43
+ </div>
44
+ </div>
45
+ <div class="show-bar" @click="isShowCode = !isShowCode">
46
+ <div class="icon">
47
+ <Icon v-if="!isShowCode" size="20">
48
+ <Code24Regular />
49
+ </Icon>
50
+ <Icon v-if="isShowCode" size="20">
51
+ <ChevronUp24Regular />
52
+ </Icon>
53
+ </div>
54
+
55
+ {{ isShowCode ? '关闭' : '显示源码' }}
56
+ </div>
57
+ </div>
58
+ </div>
59
+ </template>
60
+
61
+ <style lang="scss">
62
+ .demo-box {
63
+ margin: 50px 0px 50px 0px;
64
+ .demo-item {
65
+ margin: 10px 0px;
66
+ background-color: #fff;
67
+ box-shadow: 0px 3px 15px rgba(0, 0, 0, 0.08);
68
+ border-radius: 8px;
69
+ }
70
+ .hl-pre {
71
+ position: relative;
72
+ .pre-box {
73
+ margin-top: 10px;
74
+ border-radius: 8px;
75
+ }
76
+ }
77
+ .show-bar {
78
+ display: flex;
79
+ justify-content: center;
80
+ align-items: center;
81
+ border-top: 2px rgb(236, 236, 236) solid;
82
+ width: 100%;
83
+ height: 30px;
84
+ border-radius: 0px 0px 8px 8px;
85
+ font-size: 14px;
86
+ cursor: pointer;
87
+ transition: all 0.15s;
88
+ .icon {
89
+ display: flex;
90
+ justify-content: center;
91
+ align-items: center;
92
+ margin-right: 5px;
93
+ }
94
+ }
95
+ .show-bar:hover {
96
+ background-color: rgb(244, 244, 244);
97
+ }
98
+ .show-bar:active {
99
+ background-color: rgb(236, 236, 236);
100
+ }
101
+ .demo-cp {
102
+ padding: 30px;
103
+ }
104
+ }
105
+ </style>
@@ -0,0 +1,23 @@
1
+ import tippy from 'tippy.js';
2
+ import 'tippy.js/dist/tippy.css'; // optional for styling
3
+ import 'tippy.js/animations/shift-away-subtle.css';
4
+ import 'tippy.js/dist/svg-arrow.css';
5
+ import 'tippy.js/themes/light.css';
6
+
7
+ export default {
8
+ install(app: any) {
9
+ app.directive('tooltip', {
10
+ mounted(el: any, binding: any) {
11
+ tippy(el, {
12
+ theme: 'dark',
13
+ trigger: binding.value.trigger,
14
+ content: binding.value.content,
15
+ animation: 'shift-away-subtle',
16
+ interactive: true,
17
+ appendTo: 'parent',
18
+ placement: binding.value.placement,
19
+ });
20
+ },
21
+ });
22
+ },
23
+ };
@@ -15,7 +15,7 @@
15
15
  </teleport>
16
16
  </template>
17
17
  <script lang="ts" setup name="Modal">
18
- import { useDOMCreate } from '@/packages/lew';
18
+ import useDOMCreate from '../hooks/useDOMCreate';
19
19
  useDOMCreate('lew-modal');
20
20
 
21
21
  defineProps({
@@ -14,7 +14,7 @@
14
14
 
15
15
  <script lang="ts" setup>
16
16
  import { PropType } from 'vue';
17
- import { LewCheckbox } from '@/packages/lew';
17
+ import LewCheckbox from './LewCheckbox.vue';
18
18
  type Options = {
19
19
  name: string;
20
20
  id: string | number;
File without changes
File without changes
@@ -13,7 +13,7 @@
13
13
 
14
14
  <script lang="ts" setup>
15
15
  import { PropType } from 'vue';
16
- import { LewRadio } from '@/packages/lew';
16
+ import LewRadio from './LewRadio.vue';
17
17
  type Options = {
18
18
  name: string;
19
19
  id: string | number;
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { LewInput } from '@/packages/lew';
2
+ import LewInput from './LewInput.vue';
3
3
  import { ref, PropType, onMounted } from 'vue';
4
4
 
5
5
  type Options = {
File without changes
@@ -0,0 +1,107 @@
1
+ <script setup lang="ts">
2
+ defineProps({
3
+ round: {
4
+ type: Boolean,
5
+ default: false,
6
+ },
7
+ status: {
8
+ type: String,
9
+ default: '',
10
+ },
11
+ statusPosition: {
12
+ type: String,
13
+ default: '',
14
+ },
15
+ src: {
16
+ type: String,
17
+ default: '',
18
+ },
19
+ alt: {
20
+ type: String,
21
+ default: '',
22
+ },
23
+ });
24
+ </script>
25
+
26
+ <template>
27
+ <div class="lew-avatar">
28
+ <img :src="src" :class="{ round: round }" :alt="alt" />
29
+ <span
30
+ v-if="status"
31
+ class="dot"
32
+ :class="`dot-${status} dot-${statusPosition}`"
33
+ >
34
+ </span>
35
+ </div>
36
+ </template>
37
+
38
+ <style lang="scss" scoped>
39
+ .lew-avatar {
40
+ position: relative;
41
+ display: inline-block;
42
+ width: 40px;
43
+ height: 40px;
44
+
45
+ img {
46
+ width: 100%;
47
+ height: 100%;
48
+ border-radius: 5px;
49
+ }
50
+
51
+ .round {
52
+ border-radius: 50%;
53
+ }
54
+
55
+ .dot {
56
+ position: absolute;
57
+ top: -0.25rem;
58
+ left: -0.25rem;
59
+ content: '';
60
+ width: 0.6rem;
61
+ height: 0.6rem;
62
+ border-radius: 50%;
63
+ z-index: 99;
64
+ border: 2px #fff solid;
65
+ }
66
+
67
+ .dot-online {
68
+ background-color: var(--success-color);
69
+ }
70
+
71
+ .dot-busy {
72
+ background-color: var(--danger-color);
73
+ }
74
+
75
+ .dot-offline {
76
+ background-color: var(--normal-color-dark);
77
+ }
78
+
79
+ .dot-away {
80
+ background-color: var(--warning-color);
81
+ }
82
+
83
+ .dot-top-left {
84
+ top: -0.25rem;
85
+ left: -0.25rem;
86
+ }
87
+
88
+ .dot-top-right {
89
+ top: -0.25rem;
90
+ left: auto;
91
+ right: -0.25rem;
92
+ }
93
+
94
+ .dot-bottom-left {
95
+ top: auto;
96
+ bottom: -0.25rem;
97
+ left: -0.25rem;
98
+ }
99
+
100
+ .dot-bottom-right {
101
+ top: auto;
102
+ bottom: -0.25rem;
103
+ left: auto;
104
+ right: -0.25rem;
105
+ }
106
+ }
107
+ </style>
@@ -0,0 +1,13 @@
1
+ // hooks/useDOMCreate.ts
2
+ import { onUnmounted } from 'vue';
3
+
4
+ function useDOMCreate(nodeId: string): void {
5
+ const node = document.createElement('div');
6
+ node.id = nodeId;
7
+ document.body.appendChild(node);
8
+ onUnmounted(() => {
9
+ document.body.removeChild(node);
10
+ });
11
+ }
12
+
13
+ export default useDOMCreate;
@@ -0,0 +1,37 @@
1
+ import LewAvatar from './general/LewAvatar.vue';
2
+ import LewButton from './general/LewButton.vue';
3
+ import LewBadge from './general/LewBadge.vue';
4
+ import LewTitle from './general/LewTitle.vue';
5
+
6
+ import LewFormItem from './form/LewFormItem.vue';
7
+ import LewInput from './form/LewInput.vue';
8
+ import LewSelect from './form/LewSelect.vue';
9
+ import LewSwitch from './form/LewSwitch.vue';
10
+ import LewTextarea from './form/LewTextarea.vue';
11
+ import LewCheckbox from './form/LewCheckbox.vue';
12
+ import LewCheckboxGroup from './form/LewCheckboxGroup.vue';
13
+ import LewRadiobox from './form/LewRadio.vue';
14
+ import LewRadioboxGroup from './form/LewRadioGroup.vue';
15
+ import LewTabs from './form/LewTabs.vue';
16
+
17
+ import LewAlert from './feedback/LewAlert.vue';
18
+ import LewModal from './feedback/LewModal.vue';
19
+
20
+ export {
21
+ LewButton,
22
+ LewFormItem,
23
+ LewInput,
24
+ LewSelect,
25
+ LewSwitch,
26
+ LewTitle,
27
+ LewTabs,
28
+ LewBadge,
29
+ LewAvatar,
30
+ LewTextarea,
31
+ LewCheckbox,
32
+ LewCheckboxGroup,
33
+ LewRadiobox,
34
+ LewRadioboxGroup,
35
+ LewAlert,
36
+ LewModal,
37
+ };
@@ -0,0 +1,98 @@
1
+ <script setup lang="ts">
2
+ import { PropType } from 'vue';
3
+ import { LewBadge } from '../index';
4
+ import { useRouter } from 'vue-router';
5
+
6
+ const router = useRouter();
7
+
8
+ type Item = {
9
+ name: string;
10
+ path: string;
11
+ label: string;
12
+ type: string;
13
+ };
14
+
15
+ type Group = {
16
+ title: string;
17
+ items: Item[];
18
+ };
19
+
20
+ defineProps({
21
+ group: {
22
+ type: Array as PropType<Group[]>,
23
+ default() {
24
+ return [];
25
+ },
26
+ },
27
+ });
28
+
29
+ const toPath = (item: Item) => {
30
+ router.push(item.path);
31
+ };
32
+ </script>
33
+
34
+ <template>
35
+ <div class="siderbar btf-scrollbar">
36
+ <div v-for="(list, i) in group" :key="`group${i}`" class="group">
37
+ <div v-if="list.title" class="title">{{ list.title }}</div>
38
+ <div
39
+ v-for="(item, j) in list.items"
40
+ :key="`siderbar${j}`"
41
+ class="item"
42
+ @click="toPath(item)"
43
+ >
44
+ {{ item.name }}
45
+ <LewBadge
46
+ style="margin-left: 10px"
47
+ dot
48
+ :type="item.type"
49
+ ></LewBadge>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ </template>
54
+
55
+ <style lang="scss" scoped>
56
+ .siderbar {
57
+ width: 250px;
58
+ height: 100%;
59
+ overflow-y: scroll;
60
+ border-right: 1px #eee solid;
61
+ padding-top: 10px;
62
+ .group {
63
+ white-space: nowrap;
64
+
65
+ .title {
66
+ padding: 10px 20px;
67
+ font-size: 14px;
68
+ color: #999;
69
+ }
70
+
71
+ .item {
72
+ position: relative;
73
+ height: 40px;
74
+ line-height: 40px;
75
+ padding-left: 25px;
76
+ box-sizing: border-box;
77
+ list-style: none;
78
+ width: calc(100% - 30px);
79
+ margin-left: 17px;
80
+ border-radius: var(--border-radius);
81
+ cursor: pointer;
82
+ font-size: 16px;
83
+ }
84
+
85
+ .item:hover {
86
+ background: #eee;
87
+ }
88
+ }
89
+
90
+ .group:last-child {
91
+ padding-bottom: 100px;
92
+ }
93
+ }
94
+
95
+ .title {
96
+ color: var(--text-color);
97
+ }
98
+ </style>
package/src/env.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ declare module '*.vue' {
4
+ import type { DefineComponent } from 'vue';
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
6
+ const component: DefineComponent<{}, {}, any>;
7
+ export default component;
8
+ }
9
+
10
+ declare module 'highlight.js';
11
+ declare const hljs;
package/src/main.ts ADDED
@@ -0,0 +1,22 @@
1
+ import { createApp } from 'vue';
2
+ import App from './App.vue';
3
+ import router from './router/index';
4
+ import './assets/style/reset.scss';
5
+ import './assets/style/var.scss';
6
+ import './assets/style/main.scss';
7
+ import './assets/style/hljs.scss';
8
+ const app = createApp(App);
9
+ // 安装tooltip
10
+ import tooltip from './components/directive/lewTooltips';
11
+
12
+ // 自定义一个代码高亮指令
13
+ app.directive('highlight', {
14
+ mounted(el) {
15
+ const blocks = el.querySelectorAll('pre code');
16
+ blocks.forEach((block: unknown) => {
17
+ hljs.highlightBlock(block);
18
+ });
19
+ },
20
+ });
21
+ app.use(tooltip);
22
+ app.use(router).mount('#app');