@sanpjs/runtime
Version:
San Pro Runtime
32 lines (31 loc) • 1.21 kB
TypeScript
/**
* @file San Pro 基础组件类 Lazy san版本在3.10以上支持
* 支持:
* 1. 组件异步加载,未加载时可显示占位字符
* 2. 控制组件何时开始加载、延迟指定时间加载
* 使用:
* 1. 传入placeholder属性,string类型:
* <lazy placeholder="占位文字"></lazy>
* 2. 传入load属性,控制是否加载,true加载,false不加载(默认true):
* <lazy load="false"></lazy>
* 3. 传入list属性,其中每项为lazy加载的组件描述,具体格式如下:
* lazyList = [
* {
* name: 'ui-content', // 渲染的组件名称,必选
* component: 'content.js', // 组件相对components目录的路径,仅支持js文件 必选
* data: {}, // 组件的数据,可选
* placeholder: 'content placeholder', // 占位组件的文字,可选
* delay: 0 // 延迟加载时间ms,延迟期间仍显示占位文字,可选
* },
* {...}
* ];
* <lazy list="{{lazyList}}"></lazy>
*/
import { Component } from 'san';
import type { lazyInitData } from '../types';
export default class Lazy extends Component {
static template: string;
static components: {};
initData(): lazyInitData;
inited(): void;
}