|
|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div class="dialog-actions-container">
|
|
|
<div class="dialog-action-part dialog-action-left">
|
|
|
- <a-tooltip :content="$t('conversation.copy')" position="right">
|
|
|
+ <a-tooltip :content="$t('conversation.copy')" position="right" v-if="isEnableBtn('copy')">
|
|
|
<div class="action-btn-item" @click="handleCopy">
|
|
|
<icon-copy size="18" />
|
|
|
</div>
|
|
|
@@ -30,8 +30,43 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
+import { ref, computed } from 'vue';
|
|
|
+
|
|
|
+const props = defineProps({
|
|
|
+ /**
|
|
|
+ * 可用的操作按钮
|
|
|
+ */
|
|
|
+ action_list: Array
|
|
|
+});
|
|
|
+
|
|
|
const emit = defineEmits(['copy', 'retry', 'share']);
|
|
|
|
|
|
+/**
|
|
|
+ * 检查一个按钮是否可用
|
|
|
+ * @param btn_name
|
|
|
+ */
|
|
|
+function isEnableBtn(btn_name) {
|
|
|
+ if (!btn_name) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!props.action_list) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!Array.isArray(props.action_list)) {
|
|
|
+ // 非数组
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 按钮不存在,不可用
|
|
|
+ if (props.action_list.indexOf(btn_name) >= 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* 复制内容
|
|
|
*/
|