Browse Source

fix copy empty status bug

wolyshaw 4 years ago
parent
commit
ec1319bd1b
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/components/copy-text/index.vue

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

@@ -22,13 +22,15 @@ export default {
   },
   },
   computed: {
   computed: {
     textContent() {
     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: {
   methods: {
     copyText() {
     copyText() {
-      const slot = this.$slots.default || []
-      const text = slot[0]?.text || this.text
+      const text = this.textContent
       if (text) {
       if (text) {
         copy(text)
         copy(text)
         if (this.hint) {
         if (this.hint) {