瀏覽代碼

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) {