matrix_components 2.0.380 → 2.0.382
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/dist/matrix_components.css +1 -1
- package/dist/matrix_components.js +29 -7
- package/dist/matrix_components.umd.cjs +1 -1
- package/package.json +1 -1
- package/dist/ComponentDemo/DialogDemo.vue +0 -210
- package/dist/ComponentDemo/ExampleFormConfig.js +0 -270
- package/dist/ComponentDemo/ExcelDemo.vue +0 -263
- package/dist/ComponentDemo/FormDemo.vue +0 -476
- package/dist/ComponentDemo/ImageDemo.vue +0 -27
- package/dist/ComponentDemo/MDDemo.vue +0 -20
- package/dist/ComponentDemo/OfficeDemo.vue +0 -189
- package/dist/ComponentDemo/PdfDemo.vue +0 -207
- package/dist/ComponentDemo/SaturationLineDemo.vue +0 -592
- package/dist/ComponentDemo/SimpleFormConfig.json +0 -97
- package/dist/ComponentDemo/Test.vue +0 -437
- package/dist/ComponentDemo/TestFormConfig.js +0 -129
- package/dist/ComponentDemo/VideoDemo.vue +0 -301
- package/dist/ComponentDemo/WordDemo.vue +0 -191
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="demo-container">
|
|
3
|
-
<div class="control-panel">
|
|
4
|
-
<h3>PDF 文档预览演示</h3>
|
|
5
|
-
|
|
6
|
-
<!-- 文件上传方式 -->
|
|
7
|
-
<div class="upload-section">
|
|
8
|
-
<h4>方式一:文件上传</h4>
|
|
9
|
-
<input
|
|
10
|
-
type="file"
|
|
11
|
-
@change="importPdf(($event.target as any)?.files?.[0])"
|
|
12
|
-
accept=".pdf"
|
|
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="pdfUrl"
|
|
22
|
-
type="text"
|
|
23
|
-
placeholder="请输入PDF文档的URL地址"
|
|
24
|
-
class="url-input"
|
|
25
|
-
/>
|
|
26
|
-
<button @click="loadFromUrl" :disabled="!pdfUrl.trim()">加载URL</button>
|
|
27
|
-
<button @click="clearUrl" :disabled="!pdfUrl">清除URL</button>
|
|
28
|
-
</div>
|
|
29
|
-
|
|
30
|
-
<!-- 搜索功能 -->
|
|
31
|
-
<div class="search-section">
|
|
32
|
-
<h4>文档搜索</h4>
|
|
33
|
-
<input
|
|
34
|
-
v-model="searchKeyword"
|
|
35
|
-
type="text"
|
|
36
|
-
placeholder="输入要搜索的关键字"
|
|
37
|
-
class="search-input"
|
|
38
|
-
/>
|
|
39
|
-
<button @click="clickPdf" :disabled="!searchKeyword.trim()">搜索</button>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
<!-- PDF组件 -->
|
|
44
|
-
<div class="pdf-container">
|
|
45
|
-
<NsPdf
|
|
46
|
-
v-if="counts"
|
|
47
|
-
ref="pdfRef"
|
|
48
|
-
:url="currentUrl"
|
|
49
|
-
:hasTool="true">
|
|
50
|
-
</NsPdf>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</template>
|
|
54
|
-
|
|
55
|
-
<script setup lang="ts">
|
|
56
|
-
import { ref, nextTick } from 'vue'
|
|
57
|
-
|
|
58
|
-
const counts = ref(true)
|
|
59
|
-
const file = ref()
|
|
60
|
-
const pdfRef = ref()
|
|
61
|
-
const pdfUrl = ref(
|
|
62
|
-
'https://501351981.github.io/vue-office/examples/dist/static/test-files/test.pdf',
|
|
63
|
-
)
|
|
64
|
-
const currentUrl = ref(pdfUrl.value)
|
|
65
|
-
const searchKeyword = ref('')
|
|
66
|
-
|
|
67
|
-
function importPdf(f: any) {
|
|
68
|
-
// 清除URL,使用文件上传
|
|
69
|
-
pdfUrl.value = ''
|
|
70
|
-
file.value = f
|
|
71
|
-
|
|
72
|
-
if (f && f.name.endsWith('.pdf')) {
|
|
73
|
-
// 创建文件URL
|
|
74
|
-
const fileUrl = URL.createObjectURL(f)
|
|
75
|
-
currentUrl.value = fileUrl
|
|
76
|
-
} else if (f) {
|
|
77
|
-
alert('请选择PDF文件')
|
|
78
|
-
clearFile()
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function loadFromUrl() {
|
|
83
|
-
if (pdfUrl.value.trim()) {
|
|
84
|
-
// 清除文件,使用URL
|
|
85
|
-
clearFile()
|
|
86
|
-
currentUrl.value = pdfUrl.value.trim()
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function clearFile() {
|
|
91
|
-
file.value = null
|
|
92
|
-
if (currentUrl.value.startsWith('blob:')) {
|
|
93
|
-
URL.revokeObjectURL(currentUrl.value)
|
|
94
|
-
}
|
|
95
|
-
currentUrl.value = ''
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function clearUrl() {
|
|
99
|
-
pdfUrl.value = ''
|
|
100
|
-
currentUrl.value = ''
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function clickPdf() {
|
|
104
|
-
if (searchKeyword.value.trim() && pdfRef.value) {
|
|
105
|
-
pdfRef.value.search(searchKeyword.value.trim())
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// 重新加载组件
|
|
110
|
-
function reloadComponent() {
|
|
111
|
-
counts.value = false
|
|
112
|
-
nextTick(() => {
|
|
113
|
-
counts.value = true
|
|
114
|
-
})
|
|
115
|
-
}
|
|
116
|
-
</script>
|
|
117
|
-
|
|
118
|
-
<style scoped lang="scss">
|
|
119
|
-
.demo-container {
|
|
120
|
-
padding: 20px;
|
|
121
|
-
max-width: 1400px;
|
|
122
|
-
margin: 0 auto;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.control-panel {
|
|
126
|
-
background: #f5f5f5;
|
|
127
|
-
padding: 20px;
|
|
128
|
-
border-radius: 8px;
|
|
129
|
-
margin-bottom: 20px;
|
|
130
|
-
|
|
131
|
-
h3 {
|
|
132
|
-
margin: 0 0 20px 0;
|
|
133
|
-
color: #333;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
h4 {
|
|
137
|
-
margin: 15px 0 10px 0;
|
|
138
|
-
color: #666;
|
|
139
|
-
font-size: 14px;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.upload-section,
|
|
144
|
-
.url-section,
|
|
145
|
-
.search-section {
|
|
146
|
-
margin-bottom: 20px;
|
|
147
|
-
padding: 15px;
|
|
148
|
-
background: white;
|
|
149
|
-
border-radius: 6px;
|
|
150
|
-
border: 1px solid #e0e0e0;
|
|
151
|
-
|
|
152
|
-
input[type='file'] {
|
|
153
|
-
margin-right: 10px;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.url-input,
|
|
157
|
-
.search-input {
|
|
158
|
-
width: 300px;
|
|
159
|
-
padding: 8px 12px;
|
|
160
|
-
border: 1px solid #ddd;
|
|
161
|
-
border-radius: 4px;
|
|
162
|
-
margin-right: 10px;
|
|
163
|
-
font-size: 14px;
|
|
164
|
-
|
|
165
|
-
&:focus {
|
|
166
|
-
outline: none;
|
|
167
|
-
border-color: #409eff;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
button {
|
|
172
|
-
padding: 8px 16px;
|
|
173
|
-
background: #409eff;
|
|
174
|
-
color: white;
|
|
175
|
-
border: none;
|
|
176
|
-
border-radius: 4px;
|
|
177
|
-
cursor: pointer;
|
|
178
|
-
margin-right: 10px;
|
|
179
|
-
font-size: 14px;
|
|
180
|
-
|
|
181
|
-
&:hover:not(:disabled) {
|
|
182
|
-
background: #337ecc;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
&:disabled {
|
|
186
|
-
background: #c0c4cc;
|
|
187
|
-
cursor: not-allowed;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.pdf-container {
|
|
193
|
-
height: 600px;
|
|
194
|
-
border: 1px solid #e0e0e0;
|
|
195
|
-
border-radius: 8px;
|
|
196
|
-
overflow: hidden;
|
|
197
|
-
margin-bottom: 20px;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
@media (max-width: 768px) {
|
|
201
|
-
.url-input,
|
|
202
|
-
.search-input {
|
|
203
|
-
width: 100% !important;
|
|
204
|
-
margin-bottom: 10px;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
</style>
|