vue-element-ui-x 1.0.3 → 1.0.4
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 +20 -9
- package/components.json +13 -0
- package/lib/components/Attachments/index.js +987 -995
- package/lib/components/Bubble/index.js +10656 -10705
- package/lib/components/BubbleList/index.js +10951 -11038
- package/lib/components/Conversations/index.js +14026 -14063
- package/lib/components/FilesCard/index.js +606 -614
- package/lib/components/Prompts/index.js +457 -470
- package/lib/components/Sender/index.js +1701 -1678
- package/lib/components/Thinking/index.js +695 -703
- package/lib/components/ThoughtChain/index.js +25117 -25173
- package/lib/components/Typewriter/index.js +10247 -10302
- package/lib/components/Welcome/index.js +357 -370
- package/lib/index.common.js +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.js +32068 -32093
- package/lib/index.umd.js +1 -1
- package/lib/mixins/index.js +61 -116
- package/package.json +24 -6
- package/src/components/Attachments/index.js +8 -8
- package/src/components/Bubble/index.js +6 -6
- package/src/components/BubbleList/index.js +8 -8
- package/src/components/BubbleList/src/loading.vue +75 -75
- package/src/components/Conversations/index.js +8 -8
- package/src/components/FilesCard/index.js +8 -8
- package/src/components/FilesCard/src/fileSvg/audio.vue +38 -38
- package/src/components/FilesCard/src/fileSvg/code.vue +35 -35
- package/src/components/FilesCard/src/fileSvg/database.vue +94 -94
- package/src/components/FilesCard/src/fileSvg/excel.vue +38 -38
- package/src/components/FilesCard/src/fileSvg/file.vue +40 -40
- package/src/components/FilesCard/src/fileSvg/image.vue +40 -40
- package/src/components/FilesCard/src/fileSvg/index.js +46 -46
- package/src/components/FilesCard/src/fileSvg/link.vue +54 -54
- package/src/components/FilesCard/src/fileSvg/mark.vue +38 -38
- package/src/components/FilesCard/src/fileSvg/pdf.vue +38 -38
- package/src/components/FilesCard/src/fileSvg/ppt.vue +38 -38
- package/src/components/FilesCard/src/fileSvg/three.vue +38 -38
- package/src/components/FilesCard/src/fileSvg/txt.vue +38 -38
- package/src/components/FilesCard/src/fileSvg/unknown.vue +54 -54
- package/src/components/FilesCard/src/fileSvg/video.vue +38 -38
- package/src/components/FilesCard/src/fileSvg/word.vue +38 -38
- package/src/components/FilesCard/src/fileSvg/zip.vue +38 -38
- package/src/components/FilesCard/src/main.vue +14 -12
- package/src/components/FilesCard/src/options.js +18 -18
- package/src/components/Prompts/index.js +8 -8
- package/src/components/Sender/index.js +8 -8
- package/src/components/Sender/src/components/ClearButton.vue +28 -28
- package/src/components/Sender/src/components/Loading.vue +53 -53
- package/src/components/Sender/src/components/SendButton.vue +26 -26
- package/src/components/Sender/src/components/SpeechButton.vue +24 -24
- package/src/components/Sender/src/components/SpeechLoading.vue +87 -87
- package/src/components/Sender/src/main.vue +47 -13
- package/src/components/Thinking/index.js +8 -8
- package/src/components/ThoughtChain/index.js +8 -8
- package/src/components/Typewriter/index.js +8 -8
- package/src/components/Welcome/index.js +8 -8
- package/src/index.js +7 -9
- package/src/styles/Sender.scss +1 -1
- package/lib/locale/lang/ar-SA.js +0 -18
- package/lib/locale/lang/ar-SA.umd.js +0 -26
- package/lib/locale/lang/de-DE.js +0 -18
- package/lib/locale/lang/de-DE.umd.js +0 -26
- package/lib/locale/lang/es-ES.js +0 -18
- package/lib/locale/lang/es-ES.umd.js +0 -26
- package/lib/locale/lang/fr-FR.js +0 -18
- package/lib/locale/lang/fr-FR.umd.js +0 -26
- package/lib/locale/lang/it-IT.js +0 -18
- package/lib/locale/lang/it-IT.umd.js +0 -26
- package/lib/locale/lang/ja-JP.js +0 -18
- package/lib/locale/lang/ja-JP.umd.js +0 -26
- package/lib/locale/lang/ko-KR.js +0 -18
- package/lib/locale/lang/ko-KR.umd.js +0 -26
- package/src/styles/button.scss +0 -302
- package/src/styles/var.scss +0 -1051
- /package/lib/locale/lang/{pt-BR.js → pt-br.js} +0 -0
- /package/lib/locale/lang/{pt-BR.umd.js → pt-br.umd.js} +0 -0
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
ref="imgRef"
|
|
51
51
|
class="el-x-filescard-img"
|
|
52
52
|
:src="_previewImgUrl"
|
|
53
|
-
:preview-src-list="_previewImgUrl ? [_previewImgUrl] : []"
|
|
53
|
+
:preview-src-list="imgPreview && _previewImgUrl ? [_previewImgUrl] : []"
|
|
54
54
|
fit="cover"
|
|
55
|
-
@click="handlePreviewAction('self')"
|
|
55
|
+
@click="imgPreview ? handlePreviewAction('self') : null"
|
|
56
56
|
/>
|
|
57
57
|
|
|
58
58
|
<!-- 无预览地址时显示默认图标 -->
|
|
@@ -338,6 +338,12 @@
|
|
|
338
338
|
},
|
|
339
339
|
},
|
|
340
340
|
watch: {
|
|
341
|
+
name: {
|
|
342
|
+
handler() {
|
|
343
|
+
this.parseFileName();
|
|
344
|
+
},
|
|
345
|
+
immediate: true,
|
|
346
|
+
},
|
|
341
347
|
imgFile: {
|
|
342
348
|
handler: async function (newFile) {
|
|
343
349
|
if (newFile) {
|
|
@@ -358,23 +364,19 @@
|
|
|
358
364
|
immediate: true,
|
|
359
365
|
},
|
|
360
366
|
},
|
|
361
|
-
mounted() {
|
|
362
|
-
this.parseFileName();
|
|
363
|
-
},
|
|
367
|
+
mounted() {},
|
|
364
368
|
methods: {
|
|
365
369
|
handleDelete() {
|
|
366
|
-
this.$emit('delete', {
|
|
367
|
-
...this.propsData,
|
|
368
|
-
});
|
|
370
|
+
this.$emit('delete', { ...this.propsData });
|
|
369
371
|
},
|
|
370
372
|
handlePreviewAction(type) {
|
|
371
|
-
if (this.imgPreview
|
|
373
|
+
if (!this.imgPreview) return;
|
|
374
|
+
|
|
375
|
+
if (this.$refs.imgRef && this._previewImgUrl && type === 'mask') {
|
|
372
376
|
this.$refs.imgRef.clickHandler();
|
|
373
377
|
}
|
|
374
378
|
if (type === 'self') {
|
|
375
|
-
this.$emit('image-preview', {
|
|
376
|
-
...this.propsData,
|
|
377
|
-
});
|
|
379
|
+
this.$emit('image-preview', { ...this.propsData });
|
|
378
380
|
}
|
|
379
381
|
},
|
|
380
382
|
parseFileName() {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export const colorMap = {
|
|
2
|
-
word: '#0078D4',
|
|
3
|
-
excel: '#00C851',
|
|
4
|
-
ppt: '#FF5722',
|
|
5
|
-
pdf: '#E53935',
|
|
6
|
-
txt: '#424242',
|
|
7
|
-
mark: '#6C6C6C',
|
|
8
|
-
image: '#FF80AB',
|
|
9
|
-
audio: '#FF7878',
|
|
10
|
-
video: '#8B72F7',
|
|
11
|
-
three: '#29B6F6',
|
|
12
|
-
code: '#00008B',
|
|
13
|
-
database: '#FF9800',
|
|
14
|
-
link: '#2962FF',
|
|
15
|
-
zip: '#673AB7',
|
|
16
|
-
file: '#FFC757',
|
|
17
|
-
unknown: '#6E9DA4',
|
|
18
|
-
};
|
|
1
|
+
export const colorMap = {
|
|
2
|
+
word: '#0078D4',
|
|
3
|
+
excel: '#00C851',
|
|
4
|
+
ppt: '#FF5722',
|
|
5
|
+
pdf: '#E53935',
|
|
6
|
+
txt: '#424242',
|
|
7
|
+
mark: '#6C6C6C',
|
|
8
|
+
image: '#FF80AB',
|
|
9
|
+
audio: '#FF7878',
|
|
10
|
+
video: '#8B72F7',
|
|
11
|
+
three: '#29B6F6',
|
|
12
|
+
code: '#00008B',
|
|
13
|
+
database: '#FF9800',
|
|
14
|
+
link: '#2962FF',
|
|
15
|
+
zip: '#673AB7',
|
|
16
|
+
file: '#FFC757',
|
|
17
|
+
unknown: '#6E9DA4',
|
|
18
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import ElXPrompts from './src/main.vue';
|
|
2
|
-
|
|
3
|
-
/* istanbul ignore next */
|
|
4
|
-
ElXPrompts.install = function (Vue) {
|
|
5
|
-
Vue.component(ElXPrompts.name, ElXPrompts);
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default ElXPrompts;
|
|
1
|
+
import ElXPrompts from './src/main.vue';
|
|
2
|
+
|
|
3
|
+
/* istanbul ignore next */
|
|
4
|
+
ElXPrompts.install = function (Vue) {
|
|
5
|
+
Vue.component(ElXPrompts.name, ElXPrompts);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default ElXPrompts;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import ElXSender from './src/main.vue';
|
|
2
|
-
|
|
3
|
-
/* istanbul ignore next */
|
|
4
|
-
ElXSender.install = function (Vue) {
|
|
5
|
-
Vue.component(ElXSender.name, ElXSender);
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default ElXSender;
|
|
1
|
+
import ElXSender from './src/main.vue';
|
|
2
|
+
|
|
3
|
+
/* istanbul ignore next */
|
|
4
|
+
ElXSender.install = function (Vue) {
|
|
5
|
+
Vue.component(ElXSender.name, ElXSender);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default ElXSender;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="el-x-send-button">
|
|
3
|
-
<el-button
|
|
4
|
-
circle
|
|
5
|
-
@click="$emit('clear')"
|
|
6
|
-
size="small"
|
|
7
|
-
>
|
|
8
|
-
<i class="el-icon-brush"></i>
|
|
9
|
-
</el-button>
|
|
10
|
-
</div>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script>
|
|
14
|
-
export default {
|
|
15
|
-
name: 'ClearButton',
|
|
16
|
-
};
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<style scoped lang="scss">
|
|
20
|
-
.el-x-send-button {
|
|
21
|
-
.el-button {
|
|
22
|
-
.el-icon-brush {
|
|
23
|
-
// 旋转180
|
|
24
|
-
transform: rotate(180deg);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="el-x-send-button">
|
|
3
|
+
<el-button
|
|
4
|
+
circle
|
|
5
|
+
@click="$emit('clear')"
|
|
6
|
+
size="small"
|
|
7
|
+
>
|
|
8
|
+
<i class="el-icon-brush"></i>
|
|
9
|
+
</el-button>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
export default {
|
|
15
|
+
name: 'ClearButton',
|
|
16
|
+
};
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<style scoped lang="scss">
|
|
20
|
+
.el-x-send-button {
|
|
21
|
+
.el-button {
|
|
22
|
+
.el-icon-brush {
|
|
23
|
+
// 旋转180
|
|
24
|
+
transform: rotate(180deg);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
</style>
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<svg
|
|
3
|
-
viewBox="0 0 1000 1000"
|
|
4
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
-
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
6
|
-
>
|
|
7
|
-
<title>Loading</title>
|
|
8
|
-
<rect
|
|
9
|
-
fill="currentColor"
|
|
10
|
-
height="250"
|
|
11
|
-
rx="24"
|
|
12
|
-
ry="24"
|
|
13
|
-
width="250"
|
|
14
|
-
x="375"
|
|
15
|
-
y="375"
|
|
16
|
-
/>
|
|
17
|
-
<circle
|
|
18
|
-
cx="500"
|
|
19
|
-
cy="500"
|
|
20
|
-
fill="none"
|
|
21
|
-
r="450"
|
|
22
|
-
stroke="currentColor"
|
|
23
|
-
stroke-width="100"
|
|
24
|
-
opacity="0.45"
|
|
25
|
-
/>
|
|
26
|
-
<circle
|
|
27
|
-
cx="500"
|
|
28
|
-
cy="500"
|
|
29
|
-
fill="none"
|
|
30
|
-
r="450"
|
|
31
|
-
stroke="currentColor"
|
|
32
|
-
stroke-width="100"
|
|
33
|
-
stroke-dasharray="600 9999999"
|
|
34
|
-
>
|
|
35
|
-
<animateTransform
|
|
36
|
-
attributeName="transform"
|
|
37
|
-
dur="1s"
|
|
38
|
-
from="0 500 500"
|
|
39
|
-
repeatCount="indefinite"
|
|
40
|
-
to="360 500 500"
|
|
41
|
-
type="rotate"
|
|
42
|
-
/>
|
|
43
|
-
</circle>
|
|
44
|
-
</svg>
|
|
45
|
-
</template>
|
|
46
|
-
|
|
47
|
-
<script>
|
|
48
|
-
export default {
|
|
49
|
-
name: 'Loading',
|
|
50
|
-
};
|
|
51
|
-
</script>
|
|
52
|
-
|
|
53
|
-
<style scoped></style>
|
|
1
|
+
<template>
|
|
2
|
+
<svg
|
|
3
|
+
viewBox="0 0 1000 1000"
|
|
4
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
6
|
+
>
|
|
7
|
+
<title>Loading</title>
|
|
8
|
+
<rect
|
|
9
|
+
fill="currentColor"
|
|
10
|
+
height="250"
|
|
11
|
+
rx="24"
|
|
12
|
+
ry="24"
|
|
13
|
+
width="250"
|
|
14
|
+
x="375"
|
|
15
|
+
y="375"
|
|
16
|
+
/>
|
|
17
|
+
<circle
|
|
18
|
+
cx="500"
|
|
19
|
+
cy="500"
|
|
20
|
+
fill="none"
|
|
21
|
+
r="450"
|
|
22
|
+
stroke="currentColor"
|
|
23
|
+
stroke-width="100"
|
|
24
|
+
opacity="0.45"
|
|
25
|
+
/>
|
|
26
|
+
<circle
|
|
27
|
+
cx="500"
|
|
28
|
+
cy="500"
|
|
29
|
+
fill="none"
|
|
30
|
+
r="450"
|
|
31
|
+
stroke="currentColor"
|
|
32
|
+
stroke-width="100"
|
|
33
|
+
stroke-dasharray="600 9999999"
|
|
34
|
+
>
|
|
35
|
+
<animateTransform
|
|
36
|
+
attributeName="transform"
|
|
37
|
+
dur="1s"
|
|
38
|
+
from="0 500 500"
|
|
39
|
+
repeatCount="indefinite"
|
|
40
|
+
to="360 500 500"
|
|
41
|
+
type="rotate"
|
|
42
|
+
/>
|
|
43
|
+
</circle>
|
|
44
|
+
</svg>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
export default {
|
|
49
|
+
name: 'Loading',
|
|
50
|
+
};
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<style scoped></style>
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="el-x-send-button">
|
|
3
|
-
<el-button
|
|
4
|
-
circle
|
|
5
|
-
:disabled="disabled"
|
|
6
|
-
@click="$emit('submit')"
|
|
7
|
-
size="small"
|
|
8
|
-
>
|
|
9
|
-
<i class="el-icon-top"></i>
|
|
10
|
-
</el-button>
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script>
|
|
15
|
-
export default {
|
|
16
|
-
name: 'SendButton',
|
|
17
|
-
props: {
|
|
18
|
-
disabled: {
|
|
19
|
-
type: Boolean,
|
|
20
|
-
default: false,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<style scoped lang="scss"></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="el-x-send-button">
|
|
3
|
+
<el-button
|
|
4
|
+
circle
|
|
5
|
+
:disabled="disabled"
|
|
6
|
+
@click="$emit('submit')"
|
|
7
|
+
size="small"
|
|
8
|
+
>
|
|
9
|
+
<i class="el-icon-top"></i>
|
|
10
|
+
</el-button>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
export default {
|
|
16
|
+
name: 'SendButton',
|
|
17
|
+
props: {
|
|
18
|
+
disabled: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<style scoped lang="scss"></style>
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="el-x-send-button">
|
|
3
|
-
<el-button
|
|
4
|
-
circle
|
|
5
|
-
size="small"
|
|
6
|
-
@click="onClick"
|
|
7
|
-
>
|
|
8
|
-
<i class="el-icon-microphone"></i>
|
|
9
|
-
</el-button>
|
|
10
|
-
</div>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script>
|
|
14
|
-
export default {
|
|
15
|
-
name: 'SpeechButton',
|
|
16
|
-
methods: {
|
|
17
|
-
onClick() {
|
|
18
|
-
this.$emit('click');
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<style scoped lang="scss"></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="el-x-send-button">
|
|
3
|
+
<el-button
|
|
4
|
+
circle
|
|
5
|
+
size="small"
|
|
6
|
+
@click="onClick"
|
|
7
|
+
>
|
|
8
|
+
<i class="el-icon-microphone"></i>
|
|
9
|
+
</el-button>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
export default {
|
|
15
|
+
name: 'SpeechButton',
|
|
16
|
+
methods: {
|
|
17
|
+
onClick() {
|
|
18
|
+
this.$emit('click');
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<style scoped lang="scss"></style>
|
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<svg
|
|
3
|
-
:class="className"
|
|
4
|
-
color="currentColor"
|
|
5
|
-
:viewBox="`0 0 ${SIZE} ${SIZE}`"
|
|
6
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
-
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
8
|
-
>
|
|
9
|
-
<title>Speech Recording</title>
|
|
10
|
-
|
|
11
|
-
<rect
|
|
12
|
-
v-for="(item, index) in rects"
|
|
13
|
-
:key="index"
|
|
14
|
-
fill="currentColor"
|
|
15
|
-
:rx="RECT_RADIUS"
|
|
16
|
-
:ry="RECT_RADIUS"
|
|
17
|
-
:height="RECT_HEIGHT_MIN"
|
|
18
|
-
:width="RECT_WIDTH"
|
|
19
|
-
:x="item.x"
|
|
20
|
-
:y="item.yMin"
|
|
21
|
-
>
|
|
22
|
-
<animate
|
|
23
|
-
attributeName="height"
|
|
24
|
-
:values="`${RECT_HEIGHT_MIN}; ${RECT_HEIGHT_MAX}; ${RECT_HEIGHT_MIN}`"
|
|
25
|
-
keyTimes="0; 0.5; 1"
|
|
26
|
-
:dur="`${DURATION}s`"
|
|
27
|
-
:begin="`${(DURATION / COUNT) * index}s`"
|
|
28
|
-
repeatCount="indefinite"
|
|
29
|
-
/>
|
|
30
|
-
<animate
|
|
31
|
-
attributeName="y"
|
|
32
|
-
:values="`${item.yMin}; ${item.yMax}; ${item.yMin}`"
|
|
33
|
-
keyTimes="0; 0.5; 1"
|
|
34
|
-
:dur="`${DURATION}s`"
|
|
35
|
-
:begin="`${(DURATION / COUNT) * index}s`"
|
|
36
|
-
repeatCount="indefinite"
|
|
37
|
-
/>
|
|
38
|
-
</rect>
|
|
39
|
-
</svg>
|
|
40
|
-
</template>
|
|
41
|
-
|
|
42
|
-
<script>
|
|
43
|
-
export default {
|
|
44
|
-
name: 'SpeechLoading',
|
|
45
|
-
|
|
46
|
-
props: {
|
|
47
|
-
className: {
|
|
48
|
-
type: String,
|
|
49
|
-
default: '',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
data() {
|
|
54
|
-
return {
|
|
55
|
-
// 定义常量
|
|
56
|
-
SIZE: 1000,
|
|
57
|
-
COUNT: 4,
|
|
58
|
-
RECT_WIDTH: 140,
|
|
59
|
-
RECT_RADIUS: 70, // RECT_WIDTH / 2
|
|
60
|
-
RECT_HEIGHT_MIN: 250,
|
|
61
|
-
RECT_HEIGHT_MAX: 500,
|
|
62
|
-
DURATION: 0.8,
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
computed: {
|
|
67
|
-
// 计算矩形的位置和高度范围
|
|
68
|
-
rects() {
|
|
69
|
-
const dest = (this.SIZE - this.RECT_WIDTH * this.COUNT) / (this.COUNT - 1);
|
|
70
|
-
return Array.from({
|
|
71
|
-
length: this.COUNT,
|
|
72
|
-
}).map((_, index) => {
|
|
73
|
-
const x = index * (dest + this.RECT_WIDTH);
|
|
74
|
-
const yMin = this.SIZE / 2 - this.RECT_HEIGHT_MIN / 2;
|
|
75
|
-
const yMax = this.SIZE / 2 - this.RECT_HEIGHT_MAX / 2;
|
|
76
|
-
return {
|
|
77
|
-
x,
|
|
78
|
-
yMin,
|
|
79
|
-
yMax,
|
|
80
|
-
};
|
|
81
|
-
});
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
</script>
|
|
86
|
-
|
|
87
|
-
<style scoped></style>
|
|
1
|
+
<template>
|
|
2
|
+
<svg
|
|
3
|
+
:class="className"
|
|
4
|
+
color="currentColor"
|
|
5
|
+
:viewBox="`0 0 ${SIZE} ${SIZE}`"
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
8
|
+
>
|
|
9
|
+
<title>Speech Recording</title>
|
|
10
|
+
|
|
11
|
+
<rect
|
|
12
|
+
v-for="(item, index) in rects"
|
|
13
|
+
:key="index"
|
|
14
|
+
fill="currentColor"
|
|
15
|
+
:rx="RECT_RADIUS"
|
|
16
|
+
:ry="RECT_RADIUS"
|
|
17
|
+
:height="RECT_HEIGHT_MIN"
|
|
18
|
+
:width="RECT_WIDTH"
|
|
19
|
+
:x="item.x"
|
|
20
|
+
:y="item.yMin"
|
|
21
|
+
>
|
|
22
|
+
<animate
|
|
23
|
+
attributeName="height"
|
|
24
|
+
:values="`${RECT_HEIGHT_MIN}; ${RECT_HEIGHT_MAX}; ${RECT_HEIGHT_MIN}`"
|
|
25
|
+
keyTimes="0; 0.5; 1"
|
|
26
|
+
:dur="`${DURATION}s`"
|
|
27
|
+
:begin="`${(DURATION / COUNT) * index}s`"
|
|
28
|
+
repeatCount="indefinite"
|
|
29
|
+
/>
|
|
30
|
+
<animate
|
|
31
|
+
attributeName="y"
|
|
32
|
+
:values="`${item.yMin}; ${item.yMax}; ${item.yMin}`"
|
|
33
|
+
keyTimes="0; 0.5; 1"
|
|
34
|
+
:dur="`${DURATION}s`"
|
|
35
|
+
:begin="`${(DURATION / COUNT) * index}s`"
|
|
36
|
+
repeatCount="indefinite"
|
|
37
|
+
/>
|
|
38
|
+
</rect>
|
|
39
|
+
</svg>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
export default {
|
|
44
|
+
name: 'SpeechLoading',
|
|
45
|
+
|
|
46
|
+
props: {
|
|
47
|
+
className: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: '',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
data() {
|
|
54
|
+
return {
|
|
55
|
+
// 定义常量
|
|
56
|
+
SIZE: 1000,
|
|
57
|
+
COUNT: 4,
|
|
58
|
+
RECT_WIDTH: 140,
|
|
59
|
+
RECT_RADIUS: 70, // RECT_WIDTH / 2
|
|
60
|
+
RECT_HEIGHT_MIN: 250,
|
|
61
|
+
RECT_HEIGHT_MAX: 500,
|
|
62
|
+
DURATION: 0.8,
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
computed: {
|
|
67
|
+
// 计算矩形的位置和高度范围
|
|
68
|
+
rects() {
|
|
69
|
+
const dest = (this.SIZE - this.RECT_WIDTH * this.COUNT) / (this.COUNT - 1);
|
|
70
|
+
return Array.from({
|
|
71
|
+
length: this.COUNT,
|
|
72
|
+
}).map((_, index) => {
|
|
73
|
+
const x = index * (dest + this.RECT_WIDTH);
|
|
74
|
+
const yMin = this.SIZE / 2 - this.RECT_HEIGHT_MIN / 2;
|
|
75
|
+
const yMax = this.SIZE / 2 - this.RECT_HEIGHT_MAX / 2;
|
|
76
|
+
return {
|
|
77
|
+
x,
|
|
78
|
+
yMin,
|
|
79
|
+
yMax,
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
</script>
|
|
86
|
+
|
|
87
|
+
<style scoped></style>
|