Skip to content

Commit b72b93d

Browse files
committed
新增:模型说明中 code 标签点击自动复制功能
1 parent 20c6d05 commit b72b93d

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

changelog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
## v0.13.0
1+
## v0.13.0 Mac模型导入自动修复,模型说明自动复制,视频预览优化
22

33
- 新增:Mac模型导入时支持自动修复模型文件签名
4+
- 新增:模型说明中 code 标签点击自动复制功能
45
- 优化:视频播放组件概率性不能动态刷新问题
56
- 优化:Logo打包脚本和Logo样式
67
- 优化:CosyVoice模型调用方式

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aigcpanel",
3-
"version": "0.12.0",
3+
"version": "0.13.0",
44
"main": "dist-electron/main/index.js",
55
"description": "一站式AI数字人系统",
66
"author": "ModStartLib",

src/components/Server/ServerContentInfoAction.vue

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
2-
import {computed, ref} from "vue";
2+
import {computed, ref, watch} from "vue";
33
import ServerCloudDemoDialog from "./ServerCloudDemoDialog.vue";
4+
import {doCopy} from "../common/util";
45
56
const demoDialog = ref<InstanceType<typeof ServerCloudDemoDialog> | null>(null)
67
@@ -30,6 +31,21 @@ const content = computed(() => {
3031
}
3132
return lines.join('\n')
3233
})
34+
watch(() => visible.value, (v) => {
35+
if (v) {
36+
const codeElements = document.querySelectorAll('.pb-content-info code');
37+
codeElements.forEach((codeElement) => {
38+
if (codeElement.getAttribute('data-click-bind')) {
39+
return
40+
}
41+
codeElement.addEventListener('click', () => {
42+
const text = codeElement.textContent || ''
43+
doCopy(text);
44+
})
45+
codeElement.setAttribute('data-click-bind', 'true')
46+
});
47+
}
48+
})
3349
</script>
3450

3551
<template>
@@ -45,7 +61,7 @@ const content = computed(() => {
4561
<template #title>
4662
{{ $t('使用说明') }}
4763
</template>
48-
<div class="overflow-y-auto overflow-x-hidden leading-6" style="max-height:60vh;">
64+
<div class="overflow-y-auto overflow-x-hidden leading-6 pb-content-info" style="max-height:60vh;">
4965
<div v-html="content"></div>
5066
</div>
5167
</a-modal>
@@ -57,3 +73,16 @@ const content = computed(() => {
5773
</a-button>
5874
<ServerCloudDemoDialog ref="demoDialog"/>
5975
</template>
76+
77+
<style lang="less" scoped>
78+
.pb-content-info {
79+
:deep(code) {
80+
background: rgba(0, 0, 0, 0.05);
81+
border-radius: 0.2rem;
82+
display: inline-block;
83+
padding: 0.1rem 0.2rem;
84+
cursor: pointer;
85+
margin-bottom: 0.2rem;
86+
}
87+
}
88+
</style>

0 commit comments

Comments
 (0)