123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <template>
- <div class="elem-composition-element">
- <div :class="classes" :style="styles" :id="data.id">
- <component :is="compName" :data="data"></component>
- </div>
- </div>
- </template>
- <script>
- import ElemText from "../text/ElemText";
- import ElemImage from "../image/ElemImage";
- import ElemLine from "../line/ElemLine";
- import ElemLines from "../lines/ElemLines";
- import ElemGrids from "../grids/ElemGrids";
- export default {
- name: "elem-composition-element",
- components: {
- ElemText,
- ElemImage,
- ElemLine,
- ElemLines,
- ElemGrids
- },
- props: {
- data: {
- type: Object
- }
- },
- data() {
- return {};
- },
- computed: {
- compName() {
- if (this.data.type.includes("LINE_")) return "elem-line";
- return `elem-${this.data.type.toLowerCase()}`;
- },
- elementName() {
- return this.data.type.toLowerCase().replace("_", "-");
- },
- classes() {
- return [
- "composition-element-body",
- `composition-element-${this.elementName}`
- ];
- },
- styles() {
- return {
- left: this.data.x + "px",
- top: this.data.y + "px",
- width: this.data.w + "px",
- height: this.data.h + "px"
- };
- }
- }
- };
- </script>
|