<template>
    <div :class="['app-rawitem-image', model.sysCss]" :style="containerStyle">
        <img v-if="imgUrl" :src="imgUrl" />
        <i v-else :class="imageClass ? imageClass : ''"></i>
    </div>
</template>
<script lang = 'ts'>
import { PanelFieldModel } from '@/model/panel-detail';
import { Vue, Component, Prop, Watch, Provide } from 'vue-property-decorator';
@Component({})
export default class AppRawItemImage extends Vue {

    /**
     * 模型
     *
     * @type {*}
     * @memberof AppRawItemImage
     */
    @Prop() public model!: PanelFieldModel;

    /**
     * 图片地址
     *
     * @type {string}
     * @memberof AppRawItemImage
     */
    @Prop() public imgUrl?: string;

    /**
     * 图标
     *
     * @type {string}
     * @memberof AppRawItemImage
     */
    @Prop() public imageClass?: string;

    /**
     * 容器样式
     *
     * @type {any}
     * @memberof AppRawItemImage
     */
    public containerStyle: any = null;

    created() {
        if (this.model) {
            this.containerStyle = this.model.getElementStyle();
        }
    }

}
</script>
<style lang = "less">
@import './app-rawitem-image.less';
</style>