99 lines
2.0 KiB
Vue
Raw Normal View History

2024-12-11 14:56:50 +08:00
<template>
<div class="property-engine" @click="onPlaceInTree">
2024-12-11 14:56:50 +08:00
<i class="icon iconfont" :class="getEngineTypeIcon()"></i>
<div class="type">{{ data.engineType }}</div>
<div class="name">{{ data.engineName }}</div>
</div>
</template>
<script lang="ts">
import { defineComponent, PropType, toRaw } from "vue";
2024-12-28 14:25:23 +08:00
import { Bus, BusMsg } from "../bus";
2024-12-27 14:23:27 +08:00
import { EngineData } from "../data";
2024-12-11 14:56:50 +08:00
export default defineComponent({
name: "property-engine",
components: {},
props: {
data: {
type: Object as PropType<EngineData>,
default: () => new EngineData(),
},
},
setup(props, context) {
return {
onPlaceInTree() {
Bus.emit(BusMsg.ShowPlace, toRaw(props.data));
2024-12-11 14:56:50 +08:00
},
getEngineTypeIcon() {
switch (props.data.engineType) {
case "cc_Sprite": {
return "icon_picture";
}
case "cc_Label": {
return "icon_text";
}
case "cc_Node": {
return "icon_node";
}
}
return "icon_unknown";
},
};
},
});
</script>
<style scoped lang="less">
@my-height: 20px;
.property-engine {
cursor: pointer;
2024-12-11 14:56:50 +08:00
height: @my-height;
box-sizing: border-box;
flex: 1;
display: flex;
flex-direction: row;
border: solid #409eff 1px;
border-radius: 3px;
align-items: center;
align-content: center;
background-color: cornflowerblue;
height: @my-height;
align-items: center;
align-content: center;
display: flex;
flex-direction: row;
margin-right: 2px;
color: white;
&:hover {
color: #414141;
}
&:active {
color: black;
}
2024-12-11 14:56:50 +08:00
.icon {
font-size: 14px;
width: @my-height;
margin: 0 1px 0 2px;
2024-12-11 14:56:50 +08:00
}
.type {
font-size: 12px;
min-width: 80px;
max-width: 80px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
2024-12-11 14:56:50 +08:00
}
.name {
user-select: none;
2024-12-11 14:56:50 +08:00
font-size: 12px;
flex: 1;
height: @my-height;
background-color: #d4873d;
2024-12-11 14:56:50 +08:00
display: flex;
padding: 0 5px;
align-items: center;
align-content: center;
}
}
</style>