【ArkTS-模式-动画-路由】
ArkTS-模式-动画-路由■ MVVM模式■ 1. View■ 2. Model■ 3. ViewModel■ router 路由■ animation■ MVVM模式■ 1. View■ 2. ModelModel层是应用的原始数据提供者代表应用的核心业务逻辑和数据。■ 3. ViewModel■ router 路由1.importrouterimportrouterfromohos.router2.添加跳转Button(){Text(${this.ResetBluetooth})// .width(20%)}.width(40%).height(50).onClick((){// 跳转到设置页面页面路径需在main_pages.json中配置router.pushUrl({url:pages/RemoteControl// 目标页面的路径})})3.路由配置文件main_pages.json 在 moudule.json5中的pages:$profile:main_pages,点击跳到main_pages.json 添加页面信息。{src:[pages/Index,pages/RemoteControl]}■ animationEntry ComponentstructPressScaleImage{State scaleValue:number1build(){Column(){Text(点击缩放效果).fontSize(18).margin(20)Image($r(app.media.stop_open)).width(80).height(80).scale({x:this.scaleValue,y:this.scaleValue}).animation({// 全局动画配置duration:100,curve:Curve.EaseOut}).onTouch((event:TouchEvent){if(event.typeTouchType.Down){this.scaleValue0.95// 按下缩小}elseif(event.typeTouchType.Up){this.scaleValue1// 抬起恢复}})}.width(100%).height(100%).justifyContent(FlexAlign.Center).alignItems(HorizontalAlign.Center)}}点击有缩放效果