UNPKG

@tarojs/components

Version:
95 lines (94 loc) 2.19 kB
// eslint-disable-next-line @typescript-eslint/no-unused-vars import { Component, Prop, Event, h } from '@stencil/core'; export class CoverImage { constructor() { this.nativeProps = {}; } imageOnLoad() { const { width, height, } = this.imgRef; this.onLoad.emit({ width, height }); } imageOnError() { this.onError.emit(); } render() { const { src, imageOnLoad, imageOnError, nativeProps } = this; return (h("img", Object.assign({ ref: img => (this.imgRef = img), src: src, onLoad: imageOnLoad.bind(this), onError: imageOnError.bind(this) }, nativeProps))); } static get is() { return "taro-cover-image-core"; } static get originalStyleUrls() { return { "$": ["./style/index.scss"] }; } static get styleUrls() { return { "$": ["./style/index.css"] }; } static get properties() { return { "src": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": false, "docs": { "tags": [], "text": "" }, "attribute": "src", "reflect": false }, "nativeProps": { "type": "unknown", "mutable": false, "complexType": { "original": "{}", "resolved": "{}", "references": {} }, "required": false, "optional": false, "docs": { "tags": [], "text": "" }, "defaultValue": "{}" } }; } static get events() { return [{ "method": "onLoad", "name": "load", "bubbles": true, "cancelable": true, "composed": true, "docs": { "tags": [], "text": "" }, "complexType": { "original": "any", "resolved": "any", "references": {} } }, { "method": "onError", "name": "error", "bubbles": true, "cancelable": true, "composed": true, "docs": { "tags": [], "text": "" }, "complexType": { "original": "any", "resolved": "any", "references": {} } }]; } }