matrix_components 2.0.478 → 2.0.501
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/README.md +7 -0
- package/dist/ComponentDemo/ImageDemo.vue +4 -3
- package/dist/ComponentDemo/MDDemo.vue +244 -12
- package/dist/ComponentDemo/ReadMe.vue +25 -0
- package/dist/ComponentDemo/SaturationLineDemo copy 2.vue +1516 -0
- package/dist/ComponentDemo/SaturationLineDemo copy 3.vue +1546 -0
- package/dist/ComponentDemo/SaturationLineDemo copy 4.vue +1557 -0
- package/dist/ComponentDemo/SaturationLineDemo copy.vue +1366 -0
- package/dist/ComponentDemo/SaturationLineDemo.vue +576 -4
- package/dist/matrix-components.d.ts +2 -0
- package/dist/matrix_components.css +1 -1
- package/dist/matrix_components.js +127 -40
- package/dist/matrix_components.umd.cjs +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -33,6 +33,13 @@ Matrix Components 是一个功能丰富的 Vue 3 企业级组件库,提供办
|
|
|
33
33
|
### 浸润线:
|
|
34
34
|

|
|
35
35
|
|
|
36
|
+
```
|
|
37
|
+
version:2.0.500
|
|
38
|
+
2026-01-23
|
|
39
|
+
更新日志:
|
|
40
|
+
1.修改NsSaturationLine文字字体
|
|
41
|
+
```
|
|
42
|
+
|
|
36
43
|
```
|
|
37
44
|
version:2.0.478
|
|
38
45
|
2026-01-13
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<NsImage :src="src" :apiUrl="apiUrl" :hasPreview="hasPreview">
|
|
3
3
|
<img
|
|
4
|
-
:src="
|
|
4
|
+
:src="errorSrc"
|
|
5
5
|
style="width: 100%; height: 100%"
|
|
6
6
|
@click.stop
|
|
7
7
|
/>
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
<script setup lang="ts">
|
|
12
12
|
import { reactive, ref } from 'vue';
|
|
13
|
-
import
|
|
14
|
-
|
|
13
|
+
import src from '@/assets/b.jpg'
|
|
14
|
+
import errorSrc from '@/assets/a.png'
|
|
15
15
|
const hasPreview = ref(true)
|
|
16
16
|
const apiUrl = reactive( {
|
|
17
17
|
type: Object,
|
|
@@ -22,6 +22,7 @@ const apiUrl = reactive( {
|
|
|
22
22
|
params: {},
|
|
23
23
|
}),
|
|
24
24
|
})
|
|
25
|
+
|
|
25
26
|
</script>
|
|
26
27
|
<style lang="scss" scoped>
|
|
27
28
|
</style>
|
|
@@ -1,20 +1,252 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
<div class="demo-container">
|
|
3
|
+
<div class="control-panel">
|
|
4
|
+
<h3>Markdown 文档预览演示</h3>
|
|
5
|
+
|
|
6
|
+
<!-- 文件上传方式 -->
|
|
7
|
+
<div class="upload-section">
|
|
8
|
+
<h4>方式一:文件上传</h4>
|
|
9
|
+
<input
|
|
10
|
+
type="file"
|
|
11
|
+
@change="importMd(($event.target as any)?.files?.[0])"
|
|
12
|
+
accept=".md,.markdown"
|
|
13
|
+
/>
|
|
14
|
+
<button @click="clearFile" :disabled="!file">清除文件</button>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<!-- URL方式 -->
|
|
18
|
+
<div class="url-section">
|
|
19
|
+
<h4>方式二:URL地址</h4>
|
|
20
|
+
<input
|
|
21
|
+
v-model="mdUrl"
|
|
22
|
+
type="text"
|
|
23
|
+
placeholder="请输入Markdown文档的URL地址"
|
|
24
|
+
class="url-input"
|
|
25
|
+
/>
|
|
26
|
+
<button @click="loadFromUrl" :disabled="!mdUrl.trim()">加载URL</button>
|
|
27
|
+
<button @click="clearUrl" :disabled="!mdUrl">清除URL</button>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<!-- 模式切换 -->
|
|
31
|
+
<div class="mode-section">
|
|
32
|
+
<h4>显示模式</h4>
|
|
33
|
+
<button
|
|
34
|
+
@click="toggleMode"
|
|
35
|
+
:class="['mode-btn', { active: mode === 'dark' }]"
|
|
36
|
+
>
|
|
37
|
+
{{ mode === 'light' ? '切换到深色模式' : '切换到浅色模式' }}
|
|
38
|
+
</button>
|
|
39
|
+
</div>
|
|
4
40
|
</div>
|
|
41
|
+
|
|
42
|
+
<!-- Markdown组件 -->
|
|
43
|
+
<div class="md-container">
|
|
44
|
+
<NsMD
|
|
45
|
+
v-if="showComponent"
|
|
46
|
+
:content="currentContent"
|
|
47
|
+
:mode="mode"
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
5
51
|
</template>
|
|
6
|
-
<script setup lang="ts" name="">
|
|
7
|
-
import { ref } from 'vue';
|
|
8
52
|
|
|
9
|
-
|
|
53
|
+
<script setup lang="ts">
|
|
54
|
+
import { ref, nextTick } from 'vue'
|
|
55
|
+
|
|
56
|
+
const showComponent = ref(true)
|
|
57
|
+
const file = ref()
|
|
58
|
+
const mdUrl = ref(
|
|
59
|
+
'https://raw.githubusercontent.com/microsoft/vscode/main/README.md',
|
|
60
|
+
)
|
|
61
|
+
const currentContent = ref('')
|
|
62
|
+
const mode = ref<'light' | 'dark'>('light')
|
|
63
|
+
|
|
64
|
+
async function importMd(f: any) {
|
|
65
|
+
// 清除URL,使用文件上传
|
|
66
|
+
mdUrl.value = ''
|
|
67
|
+
file.value = f
|
|
68
|
+
|
|
69
|
+
if (f && (f.name.endsWith('.md') || f.name.endsWith('.markdown'))) {
|
|
70
|
+
try {
|
|
71
|
+
// 读取文件内容
|
|
72
|
+
const text = await f.text()
|
|
73
|
+
currentContent.value = text
|
|
74
|
+
reloadComponent()
|
|
75
|
+
} catch (error) {
|
|
76
|
+
console.error('读取文件失败:', error)
|
|
77
|
+
alert('读取文件失败,请重试')
|
|
78
|
+
clearFile()
|
|
79
|
+
}
|
|
80
|
+
} else if (f) {
|
|
81
|
+
alert('请选择Markdown文件(.md或.markdown)')
|
|
82
|
+
clearFile()
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async function loadFromUrl() {
|
|
87
|
+
if (mdUrl.value.trim()) {
|
|
88
|
+
// 清除文件,使用URL
|
|
89
|
+
clearFile()
|
|
90
|
+
try {
|
|
91
|
+
// 从URL获取Markdown内容
|
|
92
|
+
const response = await fetch(mdUrl.value.trim())
|
|
93
|
+
if (!response.ok) {
|
|
94
|
+
throw new Error(`HTTP error! status: ${response.status}`)
|
|
95
|
+
}
|
|
96
|
+
const text = await response.text()
|
|
97
|
+
currentContent.value = text
|
|
98
|
+
reloadComponent()
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error('加载URL失败:', error)
|
|
101
|
+
clearUrl()
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function clearFile() {
|
|
107
|
+
file.value = null
|
|
108
|
+
currentContent.value = ''
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function clearUrl() {
|
|
112
|
+
mdUrl.value = ''
|
|
113
|
+
currentContent.value = ''
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function toggleMode() {
|
|
117
|
+
mode.value = mode.value === 'light' ? 'dark' : 'light'
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// 重新加载组件
|
|
121
|
+
function reloadComponent() {
|
|
122
|
+
showComponent.value = false
|
|
123
|
+
nextTick(() => {
|
|
124
|
+
showComponent.value = true
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// 初始化时加载默认URL
|
|
129
|
+
loadFromUrl()
|
|
10
130
|
</script>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
131
|
+
|
|
132
|
+
<style scoped lang="scss">
|
|
133
|
+
.demo-container {
|
|
134
|
+
padding: 20px;
|
|
135
|
+
max-width: 1400px;
|
|
136
|
+
margin: 0 auto;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.control-panel {
|
|
140
|
+
background: #f5f5f5;
|
|
141
|
+
padding: 20px;
|
|
142
|
+
border-radius: 8px;
|
|
143
|
+
margin-bottom: 20px;
|
|
144
|
+
|
|
145
|
+
h3 {
|
|
146
|
+
margin: 0 0 20px 0;
|
|
147
|
+
color: #333;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
h4 {
|
|
151
|
+
margin: 15px 0 10px 0;
|
|
152
|
+
color: #666;
|
|
153
|
+
font-size: 14px;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.upload-section,
|
|
158
|
+
.url-section,
|
|
159
|
+
.mode-section {
|
|
160
|
+
margin-bottom: 20px;
|
|
161
|
+
padding: 15px;
|
|
162
|
+
background: white;
|
|
163
|
+
border-radius: 6px;
|
|
164
|
+
border: 1px solid #e0e0e0;
|
|
165
|
+
|
|
166
|
+
input[type='file'] {
|
|
167
|
+
margin-right: 10px;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.url-input {
|
|
171
|
+
width: 300px;
|
|
172
|
+
padding: 8px 12px;
|
|
173
|
+
border: 1px solid #ddd;
|
|
174
|
+
border-radius: 4px;
|
|
175
|
+
margin-right: 10px;
|
|
176
|
+
font-size: 14px;
|
|
177
|
+
|
|
178
|
+
&:focus {
|
|
179
|
+
outline: none;
|
|
180
|
+
border-color: #409eff;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
button {
|
|
185
|
+
padding: 8px 16px;
|
|
186
|
+
background: #409eff;
|
|
187
|
+
color: white;
|
|
188
|
+
border: none;
|
|
189
|
+
border-radius: 4px;
|
|
190
|
+
cursor: pointer;
|
|
191
|
+
margin-right: 10px;
|
|
192
|
+
font-size: 14px;
|
|
193
|
+
|
|
194
|
+
&:hover:not(:disabled) {
|
|
195
|
+
background: #337ecc;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&:disabled {
|
|
199
|
+
background: #c0c4cc;
|
|
200
|
+
cursor: not-allowed;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&.mode-btn {
|
|
204
|
+
background: #666;
|
|
205
|
+
|
|
206
|
+
&:hover:not(:disabled) {
|
|
207
|
+
background: #555;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
&.active {
|
|
211
|
+
background: #1890ff;
|
|
212
|
+
|
|
213
|
+
&:hover {
|
|
214
|
+
background: #096dd9;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.md-container {
|
|
222
|
+
min-height: 600px;
|
|
223
|
+
border: 1px solid #e0e0e0;
|
|
224
|
+
border-radius: 8px;
|
|
225
|
+
padding: 20px;
|
|
226
|
+
background: white;
|
|
227
|
+
overflow: auto;
|
|
228
|
+
margin-bottom: 20px;
|
|
229
|
+
|
|
230
|
+
// 深色模式样式
|
|
231
|
+
&:has(.markdown-view) {
|
|
232
|
+
transition: background-color 0.3s ease;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
@media (max-width: 768px) {
|
|
237
|
+
.url-input {
|
|
238
|
+
width: 100% !important;
|
|
239
|
+
margin-bottom: 10px;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.control-panel {
|
|
243
|
+
padding: 15px;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.upload-section,
|
|
247
|
+
.url-section,
|
|
248
|
+
.mode-section {
|
|
249
|
+
padding: 10px;
|
|
18
250
|
}
|
|
19
251
|
}
|
|
20
252
|
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="dm">
|
|
3
|
+
<NsMD class="dm-ui" :msg="msg"></NsMD>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script setup lang="ts" name="">
|
|
7
|
+
import { onMounted, ref } from 'vue';
|
|
8
|
+
const msg = ref()
|
|
9
|
+
|
|
10
|
+
onMounted(async () => {
|
|
11
|
+
const readme = await fetch(`${import.meta.env.VITE_BASE_URL}README.md`)
|
|
12
|
+
const txt = await readme.text();
|
|
13
|
+
msg.value = txt
|
|
14
|
+
})
|
|
15
|
+
</script>
|
|
16
|
+
<style lang="scss" scoped>
|
|
17
|
+
.dm {
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
.dm-ui {
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
</style>
|