Add embedded example for iOS

This commit is contained in:
pengfei.zhou
2022-07-13 16:38:20 +08:00
committed by osborn
parent e900b35281
commit c050a18546
6 changed files with 220 additions and 17 deletions

View File

@@ -10,16 +10,20 @@ import {
Gravity,
Color,
createRef,
Ref,
} from "doric";
@Entry
export class Cell1 extends Panel {
imageRef = createRef<Image>();
titleRef = createRef<Text>();
contentRef = createRef<Text>();
imageRef?: Ref<Image>;
titleRef?: Ref<Text>;
contentRef?: Ref<Text>;
data?: { imageUrl: string; title: string; content: string };
build(root: Group) {
this.imageRef = createRef<Image>();
this.titleRef = createRef<Text>();
this.contentRef = createRef<Text>();
<VLayout parent={root} layoutConfig={layoutConfig().most()} space={20}>
<Text
layoutConfig={layoutConfig().mostWidth().justHeight()}
@@ -77,11 +81,7 @@ export class Cell1 extends Panel {
//从客户端直接调用方法
setData(data: { imageUrl: string; title: string; content: string }) {
this.data = data;
if (
this.imageRef.current &&
this.titleRef.current &&
this.contentRef.current
) {
if (this.imageRef && this.titleRef && this.contentRef) {
const { imageUrl, title, content } = data;
this.imageRef.current.imageUrl = imageUrl;
this.titleRef.current.text = title;

View File

@@ -10,17 +10,21 @@ import {
Gravity,
Color,
createRef,
Ref,
} from "doric";
@Entry
export class Cell2 extends Panel {
imageRef = createRef<Image>();
titleRef = createRef<Text>();
contentRef = createRef<Text>();
imageRef?: Ref<Image>;
titleRef?: Ref<Text>;
contentRef?: Ref<Text>;
data?: { imageUrl: string; title: string; content: string };
build(root: Group) {
this.imageRef = createRef<Image>();
this.titleRef = createRef<Text>();
this.contentRef = createRef<Text>();
<VLayout parent={root} layoutConfig={layoutConfig().most()} space={20}>
<Text
layoutConfig={layoutConfig().mostWidth().justHeight()}
@@ -78,11 +82,7 @@ export class Cell2 extends Panel {
//从客户端直接调用方法
setData(data: { imageUrl: string; title: string; content: string }) {
this.data = data;
if (
this.imageRef.current &&
this.titleRef.current &&
this.contentRef.current
) {
if (this.imageRef && this.titleRef && this.contentRef) {
const { imageUrl, title, content } = data;
this.imageRef.current.imageUrl = imageUrl;
this.titleRef.current.text = title;