代码拉取完成,页面将自动刷新
import { Property, CustomElement, LSElement } from '@ls-design/core';
import '@ls-design/icons/dist/es/arrow-right';
import cellStyle from './cellStyle.css';
import cellGroupCss from './cellGroupStyle.css';
export interface Props {
title: string;
desc?: string;
to?: string;
islink?: boolean;
icon?: string;
}
@CustomElement({
tag: 'ls-cell',
style: cellStyle,
})
class LSCell extends LSElement {
@Property()
title = '';
@Property()
icon = '';
@Property()
desc = '';
@Property()
to = '';
@Property({
type: Boolean,
})
islink = false;
handleNavigation = () => {
if (this.to) {
window.location.href = this.to;
}
};
renderIcon = () => {
if (this.icon && this.icon.includes('http')) {
return <img src={this.icon} class="ls-cell-icon" style={{ marginRight: 4 }} />;
}
return null;
};
render() {
return (
<div class="ls-cell" onClick={this.handleNavigation}>
<slot name="icon">{this.renderIcon()}</slot>
<div class="ls-cell-title" id="title">
<slot name="title">{this.title}</slot>
</div>
<slot>
{this.desc && (
<div class="ls-cell-desc" id="desc">
{this.desc}
</div>
)}
{this.islink && <ls-icon-arrow-right id="arrow" />}
</slot>
</div>
);
}
}
export default LSCell;
@CustomElement({
tag: 'ls-cell-group',
style: cellGroupCss,
})
class LSCellGroup extends LSElement {
render() {
return <slot></slot>;
}
}
export { LSCellGroup };
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。