import { __decorate } from "tslib";
import { Vue, Component, Prop, Watch } from 'vue-property-decorator';
import { IBzTooltipService } from './ibz-tooltip-service';
import './ibz-tooltip-async.less';
/**
 * 异步tooltip组件
 *
 * @export
 * @class IBzTooltipAsync
 * @extends {Vue}
 */
let IBzTooltipAsync = class IBzTooltipAsync extends Vue {
    constructor() {
        super(...arguments);
        /**
         * tip请求服务
         *
         * @private
         * @type {IBzTooltipService}
         * @memberof IBzTooltipAsync
         */
        this.service = new IBzTooltipService();
        /**
         * 提示内容
         *
         * @private
         * @type {*}
         * @memberof IBzTooltipAsync
         */
        this.content = '暂无说明';
        /**
         * 是否正在加载提示
         *
         * @private
         * @memberof IBzTooltipAsync
         */
        this.isLoading = false;
        /**
         * 提示消息参数
         *
         * @private
         * @memberof IBzTooltipAsync
         */
        this.tipData = {};
    }
    async paramsWatch() {
        if (this.params) {
            this.isLoading = true;
            const data = await this.service.loadTip(this.params);
            this.isLoading = false;
            if (data) {
                this.content = data;
                return;
            }
            this.content = '暂无说明';
        }
    }
    updated() {
        this.$nextTick(() => {
            window.itc.tick();
        });
    }
    render(h) {
        return (<div class={{ 'ibz-tooltip-async-wrapper': true, loading: this.isLoading }}>
        <spin class='ibz-tooltip-loading' v-show={this.isLoading} fix/>
        <app-showdown v-show={!this.isLoading} itemValue={this.content}/>
      </div>);
    }
};
__decorate([
    Prop()
], IBzTooltipAsync.prototype, "params", void 0);
__decorate([
    Watch('params', { immediate: true })
], IBzTooltipAsync.prototype, "paramsWatch", null);
IBzTooltipAsync = __decorate([
    Component({})
], IBzTooltipAsync);
export { IBzTooltipAsync };
