ChenYangfan 6 лет назад
Родитель
Сommit
20110b6a6b
3 измененных файлов с 32 добавлено и 9 удалено
  1. 3 1
      src/components/JHeap.vue
  2. 14 4
      src/components/JMethod.vue
  3. 15 4
      src/components/JThread.vue

+ 3 - 1
src/components/JHeap.vue

@@ -3,8 +3,9 @@
     <h3>堆区</h3>
     <template v-if="objects !== null">
       <v-btn v-for="item of objects" :key="item.id" block text :color="item.fresh ? 'red' : 'black'"
-             @click="handleClickDetail">
+             @click="handleClickDetail(item)">
         <div class="button-text">{{item.id}}</div>
+        <v-icon v-if="item.id === itemNowId" color="blue" right>mdi-check</v-icon>
       </v-btn>
     </template>
   </div>
@@ -21,6 +22,7 @@ export default {
   },
   methods: {
     handleClickDetail ({ detail }) {
+      this.itemNowId = detail.id
       this.$emit('click-detail', {
         detail,
         component: 'j-heap-detail'

+ 14 - 4
src/components/JMethod.vue

@@ -1,10 +1,11 @@
 <template>
   <div>
     <h3>方法区</h3>
-    {{methods}}
     <template v-if="methods !== null">
-      <v-btn v-for="item of methods" :key="item.className" block text :color="item.fresh ? 'red' : 'black'">
+      <v-btn v-for="item of methods" :key="item.className" block text :color="item.fresh ? 'red' : 'black'"
+             @click="handleClickDetail(item)">
         <div class="button-text">{{item.className}}</div>
+        <v-icon v-if="item.className === itemNowId" color="blue" right>mdi-check</v-icon>
       </v-btn>
     </template>
   </div>
@@ -19,9 +20,18 @@ export default {
       default: () => []
     }
   },
+  data () {
+    return {
+      itemNowId: null
+    }
+  },
   methods: {
-    handleClickDetail() {
-      this.$emit('click-detail')
+    handleClickDetail (detail) {
+      this.itemNowId = detail.className
+      this.$emit('click-detail', {
+        detail,
+        component: 'j-method-detail'
+      })
     }
   }
 }

+ 15 - 4
src/components/JThread.vue

@@ -1,10 +1,11 @@
 <template>
   <div>
     <h3>线程栈</h3>
-    {{threadStack}}
     <template v-if="threadStack !== null">
-      <v-btn v-for="item of threadStack" :key="item.methodName" block text :color="item.fresh ? 'red' : 'black'">
+      <v-btn v-for="item of threadStack" :key="item.methodName" block text :color="item.fresh ? 'red' : 'black'"
+             @click="handleClickDetail(item)">
         <div class="button-text">{{item.methodName}}</div>
+        <v-icon v-if="item.methodName === itemNowId" color="blue" right>mdi-check</v-icon>
       </v-btn>
     </template>
   </div>
@@ -19,14 +20,24 @@ export default {
       default: () => []
     }
   },
+  data () {
+    return {
+      itemNowId: null
+    }
+  },
   methods: {
-    handleClickDetail() {
-      this.$emit('click-detail')
+    handleClickDetail (detail) {
+      this.itemNowId = detail.methodName
+      this.$emit('click-detail', {
+        detail,
+        component: 'j-thread-detail'
+      })
     }
   }
 }
 </script>
 
 <style lang="scss" scoped>
+@import "common.scss";
 
 </style>