Browse Source

提交哦测试

1
mo 4 years ago
parent
commit
16997c9829
1 changed files with 14 additions and 7 deletions
  1. 14 7
      src/components/select-all/index.vue

+ 14 - 7
src/components/select-all/index.vue

@@ -34,17 +34,24 @@ export default {
   name: "select-all",
   data() {
     return {
-      labelStr: "",
       isShow: false,
     };
   },
   mounted() {
-    const { selected } = this.$refs.select;
-    this.labelStr = selected
-      .map((item) => (item.label ? item.label : item.value))
-      .join(",");
-    this.isShow =
-      (this.$refs?.select?.disabled || false) && this.labelStr.length > 0;
+    this.$nextTick((res) => {
+      this.isShow =
+        (this.$refs?.select?.disabled || false) && this.labelStr.length > 0;
+    });
+  },
+  computed: {
+    labelStr() {
+      const { selected } = this.$refs.select;
+      console.log(selected);
+      let labelStr = selected
+        .map((item) => (item.label ? item.label : item.value))
+        .join(",");
+      return labelStr;
+    },
   },
   methods: {
     selectAll() {