From 8702f666d070973f5906aa51371a741807eb9a62 Mon Sep 17 00:00:00 2001 From: xyf-mac Date: Sun, 5 Dec 2021 18:21:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0log=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/.eslintrc.js | 3 ++- source/src/core/types.ts | 1 + source/src/devtools/bus.ts | 1 + source/src/devtools/data.ts | 4 +++- source/src/devtools/ui/index.vue | 4 +++- source/src/devtools/ui/property-group.vue | 17 +++++++++++++++-- source/src/inject/index.ts | 8 +++++++- 7 files changed, 32 insertions(+), 6 deletions(-) diff --git a/source/.eslintrc.js b/source/.eslintrc.js index 2beb5df..3c73a77 100644 --- a/source/.eslintrc.js +++ b/source/.eslintrc.js @@ -44,6 +44,7 @@ module.exports = { "@typescript-eslint/ban-ts-comment": "off", "no-inner-declarations": "off", "vue/no-unused-vars": "off", - "@typescript-eslint/no-namespace": "off" + "@typescript-eslint/no-namespace": "off", + "@typescript-eslint/no-this-alias": "off" } }; diff --git a/source/src/core/types.ts b/source/src/core/types.ts index c27017e..c35a9a7 100644 --- a/source/src/core/types.ts +++ b/source/src/core/types.ts @@ -17,6 +17,7 @@ export enum Msg { UpdateFrames = "UpdateFrames", // 更新页面的frame UseFrame = "UseFrame", GetObjectItemData = "GetObjectItemData", + LogData = "LogData", SetProperty = "set-property", // 设置node属性 UpdateProperty = "update-property", // 更新属性 } diff --git a/source/src/devtools/bus.ts b/source/src/devtools/bus.ts index f552e58..70f414a 100644 --- a/source/src/devtools/bus.ts +++ b/source/src/devtools/bus.ts @@ -3,6 +3,7 @@ import Vue from "vue" export enum BusMsg { ShowPlace = "ShowPlace", RequestObjectData = "RequestObjectData", + LogData = "LogData", FoldAllGroup = "FoldAllGroup" } diff --git a/source/src/devtools/data.ts b/source/src/devtools/data.ts index 7790ddc..8f3fd2d 100644 --- a/source/src/devtools/data.ts +++ b/source/src/devtools/data.ts @@ -193,11 +193,13 @@ export class Property { } export class Group { + public id: string = ""; public name: string = "group"; public data: Array = []; - constructor(name: string) { + constructor(name: string,id?:string) { this.name = name; + this.id=id||''; } addProperty(property: Property) { diff --git a/source/src/devtools/ui/index.vue b/source/src/devtools/ui/index.vue index 49dd454..baa1f12 100644 --- a/source/src/devtools/ui/index.vue +++ b/source/src/devtools/ui/index.vue @@ -147,7 +147,6 @@ export default class Index extends Vue { } - private syncSettings() { if (settings.data) { const {refreshType, refreshTime} = settings.data; @@ -204,6 +203,9 @@ export default class Index extends Vue { this.requestList.push({id: data.id, cb}); this.sendMsgToContentScript(Msg.GetObjectItemData, data) }); + Bus.$on(BusMsg.LogData, (data: string[]) => { + this.sendMsgToContentScript(Msg.LogData, data); + }) } filterNode(value: any, data: any) { diff --git a/source/src/devtools/ui/property-group.vue b/source/src/devtools/ui/property-group.vue index 3409fa7..6c939a2 100644 --- a/source/src/devtools/ui/property-group.vue +++ b/source/src/devtools/ui/property-group.vue @@ -1,11 +1,19 @@