matrix_components 2.0.315 → 2.0.317
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 +14 -0
- package/dist/matrix_components.css +1 -1
- package/dist/matrix_components.js +55 -28
- 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 -400
- package/dist/ComponentDemo/ImageDemo.vue +0 -143
- 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 -155
- package/dist/ComponentDemo/SimpleFormConfig.json +0 -97
- package/dist/ComponentDemo/Test.vue +0 -347
- package/dist/ComponentDemo/TestFormConfig.js +0 -129
- package/dist/ComponentDemo/VideoDemo.vue +0 -297
- package/dist/ComponentDemo/WordDemo.vue +0 -191
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
// 测试表单配置文件 - 用于验证默认值加载功能
|
|
2
|
-
export const formConfig = {
|
|
3
|
-
// 表单数据初始值
|
|
4
|
-
formData: {
|
|
5
|
-
testName: "默认姓名",
|
|
6
|
-
testEmail: "default@example.com",
|
|
7
|
-
testAge: 25,
|
|
8
|
-
testGender: "male",
|
|
9
|
-
testHobbies: ["reading", "music"],
|
|
10
|
-
testIsVip: true,
|
|
11
|
-
testScore: 80,
|
|
12
|
-
testBirthday: "1998-01-01",
|
|
13
|
-
testDescription: "这是默认的描述信息",
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
// 表单配置项
|
|
17
|
-
formItems: [
|
|
18
|
-
{
|
|
19
|
-
label: "姓名",
|
|
20
|
-
prop: "testName",
|
|
21
|
-
component: "input",
|
|
22
|
-
span: 12,
|
|
23
|
-
required: true,
|
|
24
|
-
placeholder: "请输入姓名",
|
|
25
|
-
props: {
|
|
26
|
-
clearable: true,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
label: "邮箱",
|
|
31
|
-
prop: "testEmail",
|
|
32
|
-
component: "input",
|
|
33
|
-
span: 12,
|
|
34
|
-
required: true,
|
|
35
|
-
props: {
|
|
36
|
-
clearable: true,
|
|
37
|
-
},
|
|
38
|
-
rules: [
|
|
39
|
-
{ type: "email", message: "请输入正确的邮箱地址", trigger: "blur" },
|
|
40
|
-
],
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
label: "年龄",
|
|
44
|
-
prop: "testAge",
|
|
45
|
-
component: "number",
|
|
46
|
-
span: 12,
|
|
47
|
-
props: {
|
|
48
|
-
min: 1,
|
|
49
|
-
max: 120,
|
|
50
|
-
controlsPosition: "right",
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
label: "性别",
|
|
55
|
-
prop: "testGender",
|
|
56
|
-
component: "radio-group",
|
|
57
|
-
span: 12,
|
|
58
|
-
options: [
|
|
59
|
-
{ label: "男", value: "male" },
|
|
60
|
-
{ label: "女", value: "female" },
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
label: "爱好",
|
|
65
|
-
prop: "testHobbies",
|
|
66
|
-
component: "checkbox-group",
|
|
67
|
-
span: 24,
|
|
68
|
-
options: [
|
|
69
|
-
{ label: "读书", value: "reading" },
|
|
70
|
-
{ label: "运动", value: "sports" },
|
|
71
|
-
{ label: "音乐", value: "music" },
|
|
72
|
-
{ label: "旅行", value: "travel" },
|
|
73
|
-
],
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
label: "VIP用户",
|
|
77
|
-
prop: "testIsVip",
|
|
78
|
-
component: "switch",
|
|
79
|
-
span: 12,
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
label: "评分",
|
|
83
|
-
prop: "testScore",
|
|
84
|
-
component: "slider",
|
|
85
|
-
span: 12,
|
|
86
|
-
props: {
|
|
87
|
-
min: 0,
|
|
88
|
-
max: 100,
|
|
89
|
-
showStops: true,
|
|
90
|
-
showTooltip: false,
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
label: "生日",
|
|
95
|
-
prop: "testBirthday",
|
|
96
|
-
component: "date-picker",
|
|
97
|
-
span: 12,
|
|
98
|
-
props: {
|
|
99
|
-
type: "date",
|
|
100
|
-
format: "YYYY-MM-DD",
|
|
101
|
-
valueFormat: "YYYY-MM-DD",
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
label: "描述",
|
|
106
|
-
prop: "testDescription",
|
|
107
|
-
component: "textarea",
|
|
108
|
-
span: 24,
|
|
109
|
-
props: {
|
|
110
|
-
rows: 4,
|
|
111
|
-
maxlength: 200,
|
|
112
|
-
showWordLimit: true,
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
|
|
117
|
-
// 表单验证规则
|
|
118
|
-
formRules: {
|
|
119
|
-
testName: [
|
|
120
|
-
{ required: true, message: "请输入姓名"},
|
|
121
|
-
],
|
|
122
|
-
testEmail: [{ required: true, message: "请输入邮箱地址"}],
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
// 下拉框选项数据源
|
|
126
|
-
optionsData: {},
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
export default formConfig;
|
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { nextTick, onMounted, reactive, ref } from 'vue'
|
|
3
|
-
|
|
4
|
-
const nsVideoRef = ref()
|
|
5
|
-
|
|
6
|
-
// 视频信息
|
|
7
|
-
const videoData = reactive({
|
|
8
|
-
// videoModel: 'hk',
|
|
9
|
-
// hkPath: '/martrix/cdn/h5player',
|
|
10
|
-
// 显示视频关闭按钮
|
|
11
|
-
showClose: true,
|
|
12
|
-
// 显示树
|
|
13
|
-
showTree: true,
|
|
14
|
-
// 树数据
|
|
15
|
-
treeData: [
|
|
16
|
-
{
|
|
17
|
-
id: '1',
|
|
18
|
-
label: '分组1',
|
|
19
|
-
children: [
|
|
20
|
-
{
|
|
21
|
-
id: '11',
|
|
22
|
-
label: '分组1-1',
|
|
23
|
-
children: [
|
|
24
|
-
{
|
|
25
|
-
videoModel: 'easyplayer',
|
|
26
|
-
id: '111',
|
|
27
|
-
label: '视频A--1视频A--1视频A--1',
|
|
28
|
-
url: 'http://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000001/hls.m3u8',
|
|
29
|
-
deviceId: 'a1',
|
|
30
|
-
channelId: 'a11',
|
|
31
|
-
icontype: 'on',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
id: 'D',
|
|
35
|
-
label: '视频A--2',
|
|
36
|
-
url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000013.live.flv',
|
|
37
|
-
deviceId: 'b1',
|
|
38
|
-
channelId: 'b11',
|
|
39
|
-
icontype: 'off',
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
id: 'b',
|
|
45
|
-
label: '分组b',
|
|
46
|
-
children: [
|
|
47
|
-
{
|
|
48
|
-
id: 'b1',
|
|
49
|
-
label: '视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1视频A--1',
|
|
50
|
-
url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000003.live.flv',
|
|
51
|
-
deviceId: 'a1',
|
|
52
|
-
channelId: 'a11',
|
|
53
|
-
icontype: 'on',
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
id: 'b2',
|
|
57
|
-
label: '视频A--2',
|
|
58
|
-
url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000015.live.flv',
|
|
59
|
-
deviceId: 'b1',
|
|
60
|
-
channelId: 'b11',
|
|
61
|
-
icontype: 'off',
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
id: 'b3',
|
|
65
|
-
label: '视频A--3',
|
|
66
|
-
url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000009.live.flv',
|
|
67
|
-
deviceId: 'c1',
|
|
68
|
-
channelId: 'c11',
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
id: 'xxx2',
|
|
77
|
-
label: '视频Zxxxx2',
|
|
78
|
-
url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000009.live.flv',
|
|
79
|
-
deviceId: '34020000001110000001',
|
|
80
|
-
channelId: '34020000001320000003',
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
// 树节点对应的key(!!!用于改变选中后的颜色)
|
|
84
|
-
treeNodeKey: 'id',
|
|
85
|
-
// 树节点展开的key
|
|
86
|
-
treeExpandedKeys: ['11'],
|
|
87
|
-
// 树节点属性 (videoUrlKey值要和treeData中的播放地址key一致, 默认为url)
|
|
88
|
-
treeOptions: {
|
|
89
|
-
icontype: 'icontype',
|
|
90
|
-
background: 'background',
|
|
91
|
-
videoUrlKey: 'url',
|
|
92
|
-
children: 'children',
|
|
93
|
-
label: 'label',
|
|
94
|
-
},
|
|
95
|
-
// 获取、设置打开的播放视频信息
|
|
96
|
-
videoInfos: [
|
|
97
|
-
{
|
|
98
|
-
index: 0,
|
|
99
|
-
url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000001.live.flv',
|
|
100
|
-
info: {
|
|
101
|
-
videoModel: 'easyplayer',
|
|
102
|
-
id: 'xxx2',
|
|
103
|
-
url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000001.live.flv',
|
|
104
|
-
deviceId: 'c1',
|
|
105
|
-
channelId: 'c11',
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
index: 1,
|
|
110
|
-
url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000015.live.flv',
|
|
111
|
-
info: {
|
|
112
|
-
videoModel: 'easyplayer',
|
|
113
|
-
id: '222',
|
|
114
|
-
url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000015.live.flv',
|
|
115
|
-
deviceId: 'c2',
|
|
116
|
-
channelId: 'c11',
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
index: 2,
|
|
121
|
-
url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000009.live.flv',
|
|
122
|
-
info: {
|
|
123
|
-
videoModel: 'easyplayer',
|
|
124
|
-
id: 'xxx2',
|
|
125
|
-
url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000009.live.flv',
|
|
126
|
-
deviceId: 'c3',
|
|
127
|
-
channelId: 'c11',
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
index: 3,
|
|
132
|
-
url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000008.live.flv',
|
|
133
|
-
info: {
|
|
134
|
-
videoModel: 'easyplayer',
|
|
135
|
-
id: 'b3',
|
|
136
|
-
url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000008.live.flv',
|
|
137
|
-
deviceId: 'c4',
|
|
138
|
-
channelId: 'c11',
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
// !!! 单点播放
|
|
143
|
-
videoSingleUrl: false,
|
|
144
|
-
// !!! 已经在播放的是否关闭后再点击打开(需要单点播 videoSingleUrl:true)
|
|
145
|
-
videoSingleClose: false,
|
|
146
|
-
// 回调函数后是否继续执行默认播放操作
|
|
147
|
-
callbackContinueExecute: true,
|
|
148
|
-
// 播放模式: 1: 单击,2: 双击
|
|
149
|
-
videoPlayModel: 1,
|
|
150
|
-
// 分屏模式: 1: 单屏, 2: 四屏, 3: 九屏
|
|
151
|
-
videoSplitType: 2,
|
|
152
|
-
// 显示分屏按钮
|
|
153
|
-
showVideoSplit: true,
|
|
154
|
-
// 分屏使用图标
|
|
155
|
-
// videoSplitUseIcon: true,
|
|
156
|
-
// 显示方向控制按钮
|
|
157
|
-
showVideoCtrls: true,
|
|
158
|
-
// 禁止控制按钮默认请求行为(默认false,true则不使用组件的发送请求仅调用自定义回调函数)
|
|
159
|
-
stopVideoCtrlMethods: true,
|
|
160
|
-
// 单个视频错误最大次数
|
|
161
|
-
videoErrorMaxCount: 3,
|
|
162
|
-
// easyplayer配置 (默认一般不需要配置, 加载不出来的时候修改)
|
|
163
|
-
videoConfig: {
|
|
164
|
-
MSE: true,
|
|
165
|
-
WCS: true,
|
|
166
|
-
WASM:true,
|
|
167
|
-
WASMSIMD: true,
|
|
168
|
-
isLive: true,
|
|
169
|
-
hasAudio: false,
|
|
170
|
-
stretch: true
|
|
171
|
-
},
|
|
172
|
-
// -----------事件回调-------------
|
|
173
|
-
// 点击树节点的操作
|
|
174
|
-
treeClick: () => {
|
|
175
|
-
console.log('点击树节点回调函数')
|
|
176
|
-
},
|
|
177
|
-
// 双击树节点的操作
|
|
178
|
-
treeDBClick: () => {
|
|
179
|
-
console.log('双击树节点回调函数')
|
|
180
|
-
},
|
|
181
|
-
// 右键树展示菜单
|
|
182
|
-
treeRightMenu: () => {
|
|
183
|
-
console.log('右键树展示菜单')
|
|
184
|
-
},
|
|
185
|
-
// 展开树节点
|
|
186
|
-
treeExpand: () => {
|
|
187
|
-
console.log('展开树节点')
|
|
188
|
-
},
|
|
189
|
-
// 视频错误回调函数
|
|
190
|
-
videoError: () => {
|
|
191
|
-
console.log('视频错误回调函数')
|
|
192
|
-
},
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
// 视频操作事件
|
|
196
|
-
const videoEvent = {
|
|
197
|
-
up: () => {
|
|
198
|
-
console.log('视频向上移动操作')
|
|
199
|
-
},
|
|
200
|
-
down: () => {
|
|
201
|
-
console.log('视频向下移动操作')
|
|
202
|
-
},
|
|
203
|
-
left: () => {
|
|
204
|
-
console.log('视频向左移动操作')
|
|
205
|
-
},
|
|
206
|
-
right: () => {
|
|
207
|
-
console.log('视频向右移动操作')
|
|
208
|
-
},
|
|
209
|
-
zoomin: () => {
|
|
210
|
-
console.log('视频放大操作')
|
|
211
|
-
},
|
|
212
|
-
zoomout: () => {
|
|
213
|
-
console.log('视频缩小操作')
|
|
214
|
-
},
|
|
215
|
-
stop: () => {
|
|
216
|
-
console.log('视频停止操作')
|
|
217
|
-
},
|
|
218
|
-
speed: () => {
|
|
219
|
-
console.log('设置视频移动速度')
|
|
220
|
-
},
|
|
221
|
-
speak: () => {
|
|
222
|
-
console.log('视频开始说话')
|
|
223
|
-
},
|
|
224
|
-
scan: () => {
|
|
225
|
-
console.log('视频扫描')
|
|
226
|
-
},
|
|
227
|
-
cruise: () => {
|
|
228
|
-
console.log('视频巡航')
|
|
229
|
-
},
|
|
230
|
-
call: () => {
|
|
231
|
-
console.log('视频调用')
|
|
232
|
-
},
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
onMounted(() => {
|
|
236
|
-
// setTimeout(() => {
|
|
237
|
-
// // !!!暴露方法
|
|
238
|
-
// // nsVideoRef.value.[setVideoUrl / removeVideo / fouceIndex / videoInfos / treeRef]
|
|
239
|
-
// // 设置视频
|
|
240
|
-
// videoData.videoInfos = [
|
|
241
|
-
// {
|
|
242
|
-
// index: 1,
|
|
243
|
-
// url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000004.live.flv',
|
|
244
|
-
// info: {
|
|
245
|
-
// videoModel: 'easyplayer',
|
|
246
|
-
// id: 'xxx',
|
|
247
|
-
// label: '视频A--3',
|
|
248
|
-
// url: 'ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000004.live.flv',
|
|
249
|
-
// deviceId: 'c1',
|
|
250
|
-
// channelId: 'c11',
|
|
251
|
-
// },
|
|
252
|
-
// },
|
|
253
|
-
// ]
|
|
254
|
-
// // }, 3000)
|
|
255
|
-
// setTimeout(() => {
|
|
256
|
-
// // 关闭视频方法1:
|
|
257
|
-
// nsVideoRef.value.removeVideo(7, true)
|
|
258
|
-
// // 关闭视频方法2:
|
|
259
|
-
// // nsVideoRef.value.setVideoUrl('', false, 7)
|
|
260
|
-
// }, 5000)
|
|
261
|
-
// 播放视频
|
|
262
|
-
// nextTick(()=>{
|
|
263
|
-
// nsVideoRef.value.setVideoUrl('ws://199.10.9.192:30200/rtp/34020000001110000001_34020000001320000010.live.flv', false, 1, {
|
|
264
|
-
// videoModel: 'easyplayer',
|
|
265
|
-
// /* videoModel: 'hk',
|
|
266
|
-
// hkPath: '/xxxx', */
|
|
267
|
-
// })
|
|
268
|
-
// })
|
|
269
|
-
})
|
|
270
|
-
function changeSplitHandler(num: number) {
|
|
271
|
-
console.log('分屏模式:如1,2,3代表单屏,四屏,九屏', num)
|
|
272
|
-
}
|
|
273
|
-
</script>
|
|
274
|
-
<template>
|
|
275
|
-
<div class="video-demo">
|
|
276
|
-
<h1 class="title" style="color: #fff" v-sline>视频组件(国标28181 + 海康威视)</h1>
|
|
277
|
-
<NsVideo class="nsvideo" ref="nsVideoRef" v-bind="videoData" v-on="videoEvent" @changeSplit='changeSplitHandler'>
|
|
278
|
-
<!-- 自定义插槽
|
|
279
|
-
<template #video-tree><span>左侧树-自定义插槽</span></template>
|
|
280
|
-
<template #video-player-head><span>播放区域头部-自定义插槽</span></template>
|
|
281
|
-
<template #video-player-view><span>播放区域主体-自定义插槽</span></template>
|
|
282
|
-
<template #video-player-foot><span>播放区域底部控制按钮-自定义插槽</span></template>
|
|
283
|
-
-->
|
|
284
|
-
</NsVideo>
|
|
285
|
-
</div>
|
|
286
|
-
</template>
|
|
287
|
-
<style scoped lang="scss">
|
|
288
|
-
.video-demo {
|
|
289
|
-
display: flex;
|
|
290
|
-
flex-direction: column;
|
|
291
|
-
height: 100%;
|
|
292
|
-
background-color: #0f2a3b;
|
|
293
|
-
.title {
|
|
294
|
-
margin-bottom: 10px;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
</style>
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="demo-container">
|
|
3
|
-
<div class="control-panel">
|
|
4
|
-
<h3>Word 文档预览演示</h3>
|
|
5
|
-
|
|
6
|
-
<!-- 文件上传方式 -->
|
|
7
|
-
<div class="upload-section">
|
|
8
|
-
<h4>方式一:文件上传</h4>
|
|
9
|
-
<input
|
|
10
|
-
type="file"
|
|
11
|
-
@change="importWord(($event.target as any)?.files?.[0])"
|
|
12
|
-
accept=".docx"
|
|
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="wordUrl"
|
|
22
|
-
type="text"
|
|
23
|
-
placeholder="请输入Word文档的URL地址"
|
|
24
|
-
class="url-input"
|
|
25
|
-
/>
|
|
26
|
-
<button @click="loadFromUrl" :disabled="!wordUrl.trim()">加载URL</button>
|
|
27
|
-
<button @click="clearUrl" :disabled="!wordUrl">清除URL</button>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<!-- Word组件 -->
|
|
32
|
-
<div class="word-container">
|
|
33
|
-
<NsWord
|
|
34
|
-
v-if="counts"
|
|
35
|
-
ref="wordRef"
|
|
36
|
-
:url="currentUrl"
|
|
37
|
-
:hasTool="true"
|
|
38
|
-
:options="wordOptions">
|
|
39
|
-
</NsWord>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
</template>
|
|
43
|
-
|
|
44
|
-
<script setup lang="ts">
|
|
45
|
-
import { ref, nextTick } from 'vue'
|
|
46
|
-
|
|
47
|
-
const counts = ref(true)
|
|
48
|
-
const file = ref()
|
|
49
|
-
const wordRef = ref()
|
|
50
|
-
const wordUrl = ref(
|
|
51
|
-
'https://501351981.github.io/vue-office/examples/dist/static/test-files/test.docx',
|
|
52
|
-
)
|
|
53
|
-
const currentUrl = ref(wordUrl.value)
|
|
54
|
-
|
|
55
|
-
// Word文档配置选项
|
|
56
|
-
const wordOptions = ref({
|
|
57
|
-
// 可以在这里配置@vue-office/docx的选项
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
function importWord(f: any) {
|
|
61
|
-
// 清除URL,使用文件上传
|
|
62
|
-
wordUrl.value = ''
|
|
63
|
-
file.value = f
|
|
64
|
-
|
|
65
|
-
if (f && f.name.endsWith('.docx')) {
|
|
66
|
-
// 创建文件URL
|
|
67
|
-
const fileUrl = URL.createObjectURL(f)
|
|
68
|
-
currentUrl.value = fileUrl
|
|
69
|
-
} else if (f) {
|
|
70
|
-
alert('请选择DOCX文件')
|
|
71
|
-
clearFile()
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function loadFromUrl() {
|
|
76
|
-
if (wordUrl.value.trim()) {
|
|
77
|
-
// 清除文件,使用URL
|
|
78
|
-
clearFile()
|
|
79
|
-
currentUrl.value = wordUrl.value.trim()
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function clearFile() {
|
|
84
|
-
file.value = null
|
|
85
|
-
if (currentUrl.value.startsWith('blob:')) {
|
|
86
|
-
URL.revokeObjectURL(currentUrl.value)
|
|
87
|
-
}
|
|
88
|
-
currentUrl.value = ''
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function clearUrl() {
|
|
92
|
-
wordUrl.value = ''
|
|
93
|
-
currentUrl.value = ''
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// 重新加载组件
|
|
97
|
-
function reloadComponent() {
|
|
98
|
-
counts.value = false
|
|
99
|
-
nextTick(() => {
|
|
100
|
-
counts.value = true
|
|
101
|
-
})
|
|
102
|
-
}
|
|
103
|
-
</script>
|
|
104
|
-
|
|
105
|
-
<style scoped lang="scss">
|
|
106
|
-
.demo-container {
|
|
107
|
-
padding: 20px;
|
|
108
|
-
max-width: 1400px;
|
|
109
|
-
margin: 0 auto;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.control-panel {
|
|
113
|
-
background: #f5f5f5;
|
|
114
|
-
padding: 20px;
|
|
115
|
-
border-radius: 8px;
|
|
116
|
-
margin-bottom: 20px;
|
|
117
|
-
|
|
118
|
-
h3 {
|
|
119
|
-
margin: 0 0 20px 0;
|
|
120
|
-
color: #333;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
h4 {
|
|
124
|
-
margin: 15px 0 10px 0;
|
|
125
|
-
color: #666;
|
|
126
|
-
font-size: 14px;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.upload-section,
|
|
131
|
-
.url-section {
|
|
132
|
-
margin-bottom: 20px;
|
|
133
|
-
padding: 15px;
|
|
134
|
-
background: white;
|
|
135
|
-
border-radius: 6px;
|
|
136
|
-
border: 1px solid #e0e0e0;
|
|
137
|
-
|
|
138
|
-
input[type='file'] {
|
|
139
|
-
margin-right: 10px;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.url-input {
|
|
143
|
-
width: 300px;
|
|
144
|
-
padding: 8px 12px;
|
|
145
|
-
border: 1px solid #ddd;
|
|
146
|
-
border-radius: 4px;
|
|
147
|
-
margin-right: 10px;
|
|
148
|
-
font-size: 14px;
|
|
149
|
-
|
|
150
|
-
&:focus {
|
|
151
|
-
outline: none;
|
|
152
|
-
border-color: #409eff;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
button {
|
|
157
|
-
padding: 8px 16px;
|
|
158
|
-
background: #409eff;
|
|
159
|
-
color: white;
|
|
160
|
-
border: none;
|
|
161
|
-
border-radius: 4px;
|
|
162
|
-
cursor: pointer;
|
|
163
|
-
margin-right: 10px;
|
|
164
|
-
font-size: 14px;
|
|
165
|
-
|
|
166
|
-
&:hover:not(:disabled) {
|
|
167
|
-
background: #337ecc;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
&:disabled {
|
|
171
|
-
background: #c0c4cc;
|
|
172
|
-
cursor: not-allowed;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
.word-container {
|
|
178
|
-
height: 600px;
|
|
179
|
-
border: 1px solid #e0e0e0;
|
|
180
|
-
border-radius: 8px;
|
|
181
|
-
overflow: hidden;
|
|
182
|
-
margin-bottom: 20px;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
@media (max-width: 768px) {
|
|
186
|
-
.url-input {
|
|
187
|
-
width: 100% !important;
|
|
188
|
-
margin-bottom: 10px;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
</style>
|