97 lines
2.0 KiB
Vue
Raw Normal View History

2019-03-15 10:08:39 +08:00
<template>
2021-04-04 19:09:44 +08:00
<div id="prop">
2021-11-20 21:57:54 +08:00
<div v-for="(group, index) in data.group" :key="index" class="group">
2021-04-04 19:09:44 +08:00
<div class="header" @click="onClickHeader(group)">
2021-06-17 22:35:37 +08:00
<div style="margin: 0 5px;">
<i v-if="group.fold" class="el-icon-caret-right"></i>
<i v-if="!group.fold" class="el-icon-caret-bottom"></i>
</div>
2021-04-04 19:09:44 +08:00
{{ group.name }}
</div>
<div class="content" v-show="!group.fold">
<ui-prop v-for="(item, index) in group.data" :key="index"
:name="item.name" :value="item.value">
</ui-prop>
2021-04-03 22:45:51 +08:00
</div>
2021-04-04 19:09:44 +08:00
</div>
2019-03-15 10:08:39 +08:00
</div>
</template>
2021-04-02 22:34:09 +08:00
<script lang="ts">
import Vue from "vue"
2021-04-06 18:50:58 +08:00
import {Component, Prop, Watch} from "vue-property-decorator"
2021-04-03 22:45:51 +08:00
import UiProp from "./ui-prop.vue"
2021-11-20 21:57:54 +08:00
import {NodeInfoData} from "@/devtools/data";
2021-04-03 11:42:08 +08:00
2021-04-02 22:34:09 +08:00
@Component({
2021-04-03 11:42:08 +08:00
components: {UiProp},
2021-04-02 22:34:09 +08:00
})
2021-04-20 11:15:30 +08:00
export default class properties extends Vue {
2021-11-20 21:57:54 +08:00
@Prop({
default: () => {
return {};
}
})
data!: NodeInfoData;
2021-04-04 19:09:44 +08:00
2021-04-04 20:48:18 +08:00
onClickHeader(group: any) {
2021-10-30 16:18:04 +08:00
if (group && group.hasOwnProperty("fold")) {
2021-04-04 20:48:18 +08:00
group.fold = !group.fold;
}
2021-04-04 19:09:44 +08:00
}
2021-11-20 21:57:54 +08:00
@Watch("data")
watchData(oldValue: NodeInfoData, newValue: NodeInfoData) {
this._initValue(oldValue.uuid === newValue.uuid);
2021-04-03 19:31:47 +08:00
}
2021-04-02 22:34:09 +08:00
created() {
2021-04-06 18:50:58 +08:00
this._initValue();
}
2021-11-20 21:57:54 +08:00
_initValue(isSameNode = true) {
if (this.data.group) {
2021-10-30 16:18:04 +08:00
// 第一个cc.Node不折叠
2021-11-20 21:57:54 +08:00
for (let i = 0; i < this.data.group.length; i++) {
let item = this.data.group[i];
2021-10-30 16:18:04 +08:00
this.$set(item, "fold", i !== 0);
}
2021-04-04 20:48:18 +08:00
}
2021-04-04 19:09:44 +08:00
}
2021-06-17 22:35:37 +08:00
2021-04-03 11:42:08 +08:00
_evalCode(code: string) {
2021-04-02 22:34:09 +08:00
if (chrome && chrome.devtools) {
chrome.devtools.inspectedWindow.eval(code);
} else {
console.log(code);
}
}
}
</script>
2021-04-04 19:09:44 +08:00
<style scoped lang="less">
#prop {
.group {
.header {
height: 40px;
display: flex;
flex-direction: row;
align-items: center;
user-select: none;
cursor: pointer;
border-bottom: 1px #6d6d6d solid;
background-color: #1da1f7;
2021-04-04 19:09:44 +08:00
}
2021-04-02 22:34:09 +08:00
2021-04-04 19:09:44 +08:00
.header:hover {
color: #6d6d6d;
}
2021-04-02 22:34:09 +08:00
2021-04-04 19:09:44 +08:00
.content {
padding: 0 5px;
}
}
2021-04-02 22:34:09 +08:00
}
2019-03-15 10:08:39 +08:00
</style>