Преглед на файлове

fix copy empty status bug

wolyshaw преди 4 години
родител
ревизия
ec1319bd1b
променени са 1 файла, в които са добавени 5 реда и са изтрити 3 реда
  1. 5 3
      src/components/copy-text/index.vue

+ 5 - 3
src/components/copy-text/index.vue

@@ -22,13 +22,15 @@ export default {
   },
   computed: {
     textContent() {
-      return this.$slots.default || this.text
+      const slot = this.$slots.default || []
+      const text = slot[0]?.text || this.text
+      console.log(text)
+      return text
     }
   },
   methods: {
     copyText() {
-      const slot = this.$slots.default || []
-      const text = slot[0]?.text || this.text
+      const text = this.textContent
       if (text) {
         copy(text)
         if (this.hint) {