platypush/platypush/backend/http/webapp/src/components/panels/Entities/Entity.vue

46 lines
855 B
Vue
Raw Normal View History

2022-04-10 13:07:36 +02:00
<template>
<div class="row item entity-container">
<component :is="component"
:value="value"
:loading="loading"
:error="error || value?.reachable == false"
@input="$emit('input', $event)"
@loading="$emit('loading', $event)"
/>
2022-04-10 13:07:36 +02:00
</div>
</template>
<script>
import { defineAsyncComponent } from 'vue'
import EntityMixin from "./EntityMixin"
2022-04-10 13:07:36 +02:00
export default {
name: "Entity",
mixins: [EntityMixin],
2022-04-12 00:43:22 +02:00
emits: ['input', 'loading'],
2022-04-10 13:07:36 +02:00
data() {
return {
component: null,
}
},
mounted() {
if (this.type !== 'Entity')
this.component = defineAsyncComponent(
() => import(`@/components/panels/Entities/${this.type}`)
)
},
}
</script>
2022-04-12 00:43:22 +02:00
<style lang="scss" scoped>
@import "common";
2022-04-10 13:07:36 +02:00
.entity-container {
2022-04-10 13:07:36 +02:00
width: 100%;
position: relative;
padding: 0 !important;
2022-04-10 13:07:36 +02:00
}
</style>