<template>
  <Col
    :class="[playState ? 'anm-' + val.animationName : '']"
    :span="val.span"
    :order="val.order"
    :offset="val.offset"
    :push="val.push"
    :pull="val.pull"
    :class-name="val.className"
    :style="{
      position: 'absolute',
      width: val.width  + '%',
      height: val.height  + '%',
      left: val.left  + '%',
      top: val.top  + '%',
      zIndex: val.z,
      backgroundColor: val.bgColor,
      backgroundImage: 'url(' + val.backPic + ')',
      color: val.color
    }"
  >
    <!-- 子组件 -->
    <slot></slot>
  </Col>
</template>

<script>
import stylec from "./style.vue";
const WIDGET_NAME = "braid-column";

export default {
  name: WIDGET_NAME,
  icon: {
    type: "ios-barcode"
  },
  title: "列",
  panel: stylec,
  setting: {
    type: WIDGET_NAME,
    isContainer: false,
    isUpload: false,
    hasGuide: true,
    isChild: true,
    draggable: true,
    resizable: true,
    name: "列",
    width: 30,
    height: 20,
    left: 20,
    top: 0,
    offsetLeft: 50,
    offsetTop: 0,
    offsetWidth: 100,  // 父组件相对于page的百分比
    offsetHeight: 100, // 父组件相对于page的百分比
    z: 0,
    bgColor: "#ccc",
    backPic: "",
    backPicUrl: "",
    color: "",
    text: "row",
    belong: "page",
    animationName: ""
  },
  props: ["h", "val", "playState", "w"],
  computed: {},

  methods: {
    updateText(e, uuid) {
      let text = e.target.innerHTML;
      this.$vpd.commit("updateData", {
        uuid: uuid,
        key: "text",
        value: text
      });
    }
  }
};
</script>

<style scoped>
.lz-container {
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100%;
}
</style>
