赞
踩
第一个页面的代码:
src/main/ets/pages/First.ets
import router from '@ohos.router' @Entry @Component struct First { build() { Column() { Text('Harmony OS') .fontSize(50) .fontWeight(FontWeight.Bold) .margin({bottom:'10vp'}) Button('点击去往下一页...') .width('50%') .height(50) .onClick(() => { router.pushUrl({ url: "pages/Second" }) }) } .width('100%') .height('100%') } }
第二个页面的代码:
src/main/ets/pages/Second.ets
import router from '@ohos.router' @Entry @Component struct Second { build() { Column() { Text('OpenHarmony OS') .fontSize(30) .fontWeight(FontWeight.Bold) .margin({bottom:'10vp'}) Button('返回...') .width("40%") .height('50vp') .onClick(()=>{ router.back(); }) } .width('100%') } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。