浏览代码

添加其他按钮

lifanagju_citu 6 月之前
父节点
当前提交
8ae9b6c6ac
共有 1 个文件被更改,包括 16 次插入1 次删除
  1. 16 1
      src/components/CtDialog/index.vue

+ 16 - 1
src/components/CtDialog/index.vue

@@ -42,6 +42,14 @@
           >
             {{ closeText }}
           </v-btn>
+          <v-btn
+            v-if="props.otherBtnText"
+            color="primary"
+            text
+            @click="handleOtherBtn"
+          >
+            {{ otherBtnText }}
+          </v-btn>
           <v-btn
             color="primary"
             text
@@ -61,7 +69,7 @@
 <script setup>
 import { ref, computed, watch  } from 'vue'
 defineOptions({ name: 'components-ct-dialog' })
-const emits = defineEmits(['update:visible', 'close', 'submit'])
+const emits = defineEmits(['update:visible', 'close', 'other', 'submit'])
 
 const props = defineProps({
   titleClass: {
@@ -100,6 +108,10 @@ const props = defineProps({
     type: Boolean,
     default: false
   },
+  otherBtnText: {
+    type: String,
+    default: ''
+  },
   closeable: {
     type: Boolean,
     default: true
@@ -123,6 +135,9 @@ const handleClose = () => {
   // emits('update:visible', false)
   emits('close', false)
 }
+const handleOtherBtn = () => {
+  emits('other', false)
+}
 const handleSave = () => {
   emits('submit', false)
 }