当前位置: 首页 > news >正文

赣州哪里可以做网站视频网站怎么做可以播放电视剧

赣州哪里可以做网站,视频网站怎么做可以播放电视剧,临漳手机网站建设,全国免费信息发布平台以下涉及的项目源码地址#xff1a; https://gitee.com/jiangqianghua/harmony-test 更多学习资源资源点我获取 1. 一些常用组件方法 加载resource/base/element/string.json资源 Text($r(app.string.Username_label))设置颜色 Color.red“#ff00ff”读取资源文…以下涉及的项目源码地址 https://gitee.com/jiangqianghua/harmony-test 更多学习资源资源点我获取 1. 一些常用组件方法 加载resource/base/element/string.json资源 Text($r(app.string.Username_label))设置颜色 Color.red“#ff00ff”读取资源文件字体颜色 resource/base/element/color.json .backgroundColor(Color.Red) .backgroundColor(#00ff00) .backgroundColor($r(app.color.start_window_background))超出显示省略号 Text(11222222222222333333333333333333333344).fontSize(20).textOverflow({overflow: TextOverflow.Ellipsis}).maxLines(1).width(100)Button形状 默认形状 Button(按钮).type(ButtonType.Normal) // 矩形// .type(ButtonType.Circle) // 圆形// .type(ButtonType.Capsule) // 胶囊2. 自定义按钮使用插槽方式Button(){Row(){LoadingProgress().width(50).height(50).color(Color.White)Text(登录).fontColor(Color.White)}}.width(120)CheckBox使用 Row(){CheckboxGroup({group: favor}).selectedColor(Color.Red).height(0).onChange((value) {console.log(JSON.stringify(value))})Text(全选/全不选)}Row(){Row(){Checkbox({group: favor, name: 1})Text(篮球)}Row(){Checkbox({group: favor, name: 2})Text(足球)}Row(){Checkbox({group: favor, name: 3})Text(乒乓球)}}Radio组件 Row(){Row(){Radio({group: favor, value: 1}).onChange((value) {value console.log(1)})Text(篮球)}Row(){Radio({group: favor, value: 2}).onChange((value) {value console.log(2)})Text(足球)}}Toggle组件 Row(){Toggle({type: ToggleType.Switch,isOn: false}).selectedColor(Color.Red)Toggle({type: ToggleType.Button,isOn: false}){Text(选择)}.selectedColor(Color.Red)Toggle({type: ToggleType.Checkbox,isOn: false}).selectedColor(Color.Red) }Image // ets/images/a.jpgImage(images/a.jpg).width(100)Image($r(app.media.icon)).width(100)// 小图片是否有锯齿.interpolation(ImageInterpolation.High)// 需要访问网络权限 在modules.json5 下// requestPermissions: [// {// name: ohos.permission.INTERNET// }// ],Image(url).width(100)Image($r(app.media.icon)).objectFit(ImageFit.Auto)// 是否重复.objectRepeat(ImageRepeat.XY)// 黑白显示.renderMode(ImageRenderMode.Template).width(100)// 是否有锯齿插值.interpolation(ImageInterpolation.High).onComplete((value) {console.log(JSON.stringify(value))//{width:114,height:114,componentWidth:300,componentHeight:300,loadingStatus:1}})2. 像素单位 px 物理像素vp 屏幕密度像素单位虚拟像素 1vp约等于3px 默认单位fp 字体像素lpx 视图逻辑像素单位等比缩放默认是7201lpx为2px大小 场景根据ui稿高度还原使用 lpx 默认值可以修改修改在resource/base/profiles/main_pages.json window: {designWidth: 1440 // 1lpx 1px 如果屏幕真实是1280 那么设置1440也是撑满}单位转换 vp2pxpx2vpfp2vppx2fplpx2px 3. 线性布局 // space 子元素间距Row({space: 10}){Text(111).layoutWeight(1).backgroundColor(Color.Red)Text(222).layoutWeight(1).backgroundColor(Color.Red)Text(333).layoutWeight(1).backgroundColor(Color.Red)}4. 空白填充组件把空余空间占满 Blank()5. 层叠布局 Stack(){Text(111).width(200).height(200).backgroundColor(Color.Red)// 设置层级.zIndex(2)Text(111).width(100).height(100).backgroundColor(Color.Yellow) }.width(100%).height(300).backgroundColor(Color.Grey) // 控制对齐位置 .alignContent(Alignment.TopStart)6. 获取List控制器 private scroll: Scroller new Scroller();...List({scroller: this.scroll})7. 弹性布局flex Flex({direction: FlexDirection.Row,justifyContent: FlexAlign.Center,// Stretch 拉伸// Baseline 文本基线对其alignItems: ItemAlign.Center}){Text(111).backgroundColor(Color.Blue).width(100).height(100)Text(222).backgroundColor(Color.Pink).width(200).height(200)Text(333).backgroundColor(Color.Brown).width(200).height(200)// 孩子单独交叉轴设置.alignSelf(ItemAlign.Start)}.width(100%).height(300).backgroundColor(Color.Gray)Flex({direction: FlexDirection.Row,justifyContent: FlexAlign.Start,// Stretch 拉伸// Baseline 文本基线对其alignItems: ItemAlign.Center,// 自动换行wrap: FlexWrap.Wrap}){Text(111).backgroundColor(Color.Blue).width(400).height(100)Text(222).backgroundColor(Color.Pink).width(100).height(100)Text(333).backgroundColor(Color.Brown).width(100).height(100)// 压缩比例.flexShrink(2)// 设置权重瓜分剩余空间.flexGrow(1)}.width(100%).height(300).backgroundColor(Color.Gray)8. 栅格布局GridRow 和 GridCol 解决不同尺寸动态布局的问题支持 xs320vpsm(320-520), md(520-840), lg(840-1080), xl(1080), xxl 断点 GridRow({// 排列方向// direction: GridRowDirection.RowReverse,// 间距gutter: 10,// columns 和下面span意思是一样但是xs:1 表示小屏是一列columns: {xs:1, sm: 2, md: 4, lg: 6, xl: 8},breakpoints: {value: [200vp, 300vp, 400vp, 500vp, 600vp]}}){ForEach(this.bgColors, (item, index) {GridCol({// 默认12栅格然后按照 xs12 表示在超小屏幕一个col就占12栅格// span: {xs:12, sm: 6, md: 4, lg: 3, xl: 2}}){Row(){Text(${index 1})}.width(100%).height(50).backgroundColor(item)}//表示一个col占6栅格会固定死会使得上面span不起作用// .span(6)})}9. 网格布局 Grid Grid(){GridItem(){Text(111)}.style()// 横跨2列.columnStart(0).columnEnd(1)GridItem(){Text(222)}.style()// 横跨2行.rowStart(0).rowEnd(1)GridItem(){Text(333)}.style()GridItem(){Text(444)}.style()GridItem(){Text(555)}.style()GridItem(){Text(666)}.style() } .width(100%) .columnsGap(10) .rowsGap(10) .height(200) .rowsTemplate(1fr 1fr) .columnsTemplate(1fr 1fr 1fr)10. 轮播组件 Entry Component struct Page_Swiper {State message: string Hello Worldprivate swiperController: SwiperController new SwiperController();build() {Row() {Column() {Swiper(this.swiperController){Text(111).itemStyle().backgroundColor(Color.Red)Text(222).itemStyle().backgroundColor(Color.Blue)Text(333).itemStyle().backgroundColor(Color.Brown)}.loop(false).autoPlay(true).interval(2000).indicatorStyle({size: 20,left: 0,color: Color.White}).vertical(true).onChange(index {// 获取当前索引console.log(index index)})Button(click).onClick(() {this.swiperController.showPrevious();})}.width(100%)}.height(100%)} }Extend(Text) function itemStyle(){.width(100%).height(200).textAlign(TextAlign.Center).fontSize(30) }11. List布局 Entry Component struct Page_List {State message: string Hello WorldState list: string[] [111, 222, 333, 444, 555, 666]private listController: Scroller new Scroller();build() {Row() {Column() {List({space: 10, scroller: this.listController}){ForEach(this.list, (item, index) {ListItem(){Text(item)}.width(100%).height(100).backgroundColor(Color.Yellow)// 控制每个item内容的位置.align(Alignment.Start)// 侧滑.swipeAction({end: this.itemEnd(index)})})}.height(300).width(100%).backgroundColor(Color.Blue)// 控制子元素位置.alignListItem(ListItemAlign.Center)// 滚动方向.listDirection(Axis.Vertical)// 分割线.divider({strokeWidth:2,startMargin: 10,endMargin: 10,color: Color.Red})// 滚动条显示方式.scrollBar(BarState.Auto).onScrollIndex((start, end) {if (end this.list.length - 1) {console.log(到底了加载新数据)}})Button(click).onClick(() {this.listController.scrollToIndex(0)})}.width(100%)}.height(100%)}BuilderitemEnd(index: number){Button(删除).backgroundColor(Color.Red)} }12. List分组布局 Entry Component struct Page_List2 {State message: string Hello WorldState cityList: Object[] [{type: A,list: [鞍山, 安顺, 安康]},{type: B,list: [北京, 保定, 包头]},{type: C,list: [长春, 长沙, 常德]}]build() {Row() {Column() {List({ space: 10 }) {ForEach(this.cityList, item {ListItemGroup({header: this.header(item.type)}){ForEach(item.list, data {ListItem(){Text(data)}.align(Alignment.Start).width(100%).height(100)})}})}.height(300).width(100%)// 粘性.sticky(StickyStyle.Header)}.width(100%)}.height(100%)}Builderheader(type: string) {Text(type).fontSize(30)} }13 Tabs容器组件导航 Entry Component struct Page_Tabs {State message: string Hello Worldbuild() {Row() {Column() {Tabs({// 导航位置barPosition: BarPosition.Start}){TabContent(){Text(电影列表).fontSize(30)}.tabBar(电影)TabContent(){Text(影院列表).fontSize(30)}.tabBar(影院)TabContent(){Text(个人中心).fontSize(30)}.tabBar(我的)}// 当tab较多可以设置滑动显示.barMode(BarMode.Scrollable)// 阻止滑动切换.scrollable(false)// 滚动方向// .vertical(true)// .barWidth(100)// .barHeight(200)}.width(100%)}.height(100%)} }14. 自定义导航 Entry Component struct Page_Tabs {State message: string Hello WorldState currentIndex: number 0private tabbarController: TabsController new TabsController();BuildertabbarItem(title: string, icon: Resource, selectedIcon: Resource, index: number){Column(){Image(this.currentIndex index ? selectedIcon : icon).size({width: 25, height: 25})Text(title).fontColor(this.currentIndex index ? Color.Red : Color.Black)}.width(33.33%).height(50)}build() {Row() {Column() {Tabs({controller: this.tabbarController,// 导航位置barPosition: BarPosition.End}){TabContent(){Text(电影列表).fontSize(30)}.tabBar(this.tabbarItem(电影, $r(app.media.icon), $r(app.media.icon), 0))TabContent(){Text(影院列表).fontSize(30)}.tabBar(this.tabbarItem(影院, $r(app.media.icon), $r(app.media.icon), 1))TabContent(){Text(个人中心).fontSize(30)}.tabBar(this.tabbarItem(我的, $r(app.media.icon), $r(app.media.icon), 2))}.onChange((index) {this.currentIndex index})// 当tab较多可以设置滑动显示.barMode(BarMode.Scrollable)// 阻止滑动切换// .scrollable(false)// 滚动方向// .vertical(true)// .barWidth(100)// .barHeight(200)}.width(100%)}.height(100%)} }15. Navigation布局 Entry Component struct Page_Nav {State message: string Hello WorldState list:Object[] [{title: 111,content: 111},{title: 222,content: 222},{title: 333,content: 333}]build() {Navigation(){List(){ForEach(this.list, item {ListItem(){// 可以很好的自适应大屏显示NavRouter(){Text(item.title).width(100%).height(70).backgroundColor(Color.White).borderRadius(25).fontSize(20).textAlign(TextAlign.Center)NavDestination(){Text(item.content).width(100%).height(100%).backgroundColor(Color.White)}.title(item.title).backgroundColor(Color.White)}}})}}.menus([{value: ,icon: ./images/a.jpg,action: () {console.log(search)}}]).toolBar({items: [{value: 笔记,icon: ./images/a.jpg,action: () {console.log(search)}},{value: 待办,icon: ./images/a.jpg,action: () {console.log(search)}}]}).title(全部笔记).height(100%).width(100%).titleMode(NavigationTitleMode.Mini).backgroundColor(Color.White)// 显示方式.mode(NavigationMode.Auto)} }15. 页面动画 页面内的动画 属性动画 // 属性动画 Entry Component struct Page_Animation2 {State message: string Hello WorldState myWidth: number 100build() {Row() {Column() {Button(显式动画).onClick(() {this.myWidth 200})Text(this.message).width(this.myWidth).height(100).backgroundColor(Color.Grey).animation({duration: 1000, curve: Curve.Linear})}.width(100%)}.height(100%)} }显示动画 Entry Component struct Page_Animation {State message: string Hello WorldState myWidth: number 100State list: string[] [1111, 2222, 33333, 44444]build() {Row() {Column() {Button(显式动画).onClick(() {animateTo({duration: 1000, curve: Curve.Ease}, () {this.myWidth 200})})Text(this.message).width(this.myWidth).height(100).backgroundColor(Color.Grey)List(){ForEach(this.list, (item, index){ListItem(){this.item(item, index)}})}.backgroundColor(Color.Blue)}.width(100%)}.height(100%)}Builderitem(item: string, index: number) {Row(){Text(item)Button(del).onClick((){animateTo({duration: 1000, curve: Curve.Linear}, (){this.list.splice(index, 1)})})}} }组件内转场动画 Entry Component struct Page_Animation3 {State message: string Hello WorldState isShow: boolean trueState list: string[] [1111, 2222, 33333, 44444]build() {Row() {Column() {// Column(){// Button(折叠/展开).onClick(() {// animateTo({duration: 1000, curve: Curve.Linear}, (){// this.isShow !this.isShow// })// })// if (this.isShow) {// Text(侧边栏)// .width(200)// .height(100)// .backgroundColor(Color.Blue)// .transition({// type: TransitionType.All,// translate: {x: -200, y: 0},// opacity: 0// })// }// }.width(100%)// .height(300)// .backgroundColor(Color.Grey)// .alignItems(HorizontalAlign.Start)}List(){ForEach(this.list, (item, index){ListItem(){this.item(item, index)}.transition({type: TransitionType.Delete,translate: {x: 200},scale: {x:0, y: 0}}).transition({type: TransitionType.Insert,translate: {y: 100}})}, itemitem)}.backgroundColor(Color.Blue).width(100%).height(400)}.height(100%)}Builderitem(item: string, index: number) {Row(){Text(item)Button(del).onClick((){animateTo({duration: 1000, curve: Curve.Linear}, (){this.list.splice(index, 1)})})}} }页面间动画 共享元素转场动画页面转场动画 // a页面pageTransition(){PageTransitionExit({ type: RouteType.Push, duration: 1000 }).slide(SlideEffect.Left)PageTransitionEnter({ type: RouteType.Pop, duration: 1000 }).slide(SlideEffect.Left)}// b页面pageTransition(){PageTransitionExit({ type: RouteType.Push, duration: 1000 }).slide(SlideEffect.Right)PageTransitionEnter({ type: RouteType.Pop, duration: 1000 }).slide(SlideEffect.Right)}16. divider 用法 .divider({strokeWidth: $r(app.float.divider_stroke_width),color: $r(app.color.item_divider)})
http://www.zqtcl.cn/news/691688/

相关文章:

  • 网站建设注意的问题网站模板 知乎
  • 自主设计和创建网站网站建设价格便宜
  • 高手做网站财经资讯网站该怎么做推广
  • 加强农业网站建设青岛全网营销推广
  • 做淘客网站怎么样济南软件公司排名
  • 企业网站优化兴田德润怎么样网站建设建设公司资质要求
  • 如何把网站做跳转浏览器链接地址wordpress 离线更新
  • 乌海学校网站建设wordpress默认主题下载
  • 海兴县做网站如何选网站建设公司
  • asp网站设为首页代码孝仙洪高速公路建设指挥部网站
  • 浦东新区网站开发人才网站建设策划书
  • 网站做flash好不好免费微信公众号素材网
  • 开发网站嵌入广告汕头电商网站建设
  • 电脑做科目一网站购物网站怎么创建
  • c2c网站建设公司wordpress被公众号干掉
  • wordpress托管建站网站页面布局和样式设计
  • 建站平台江苏省建设监理协会网站
  • 安徽网站开发培训价格百度seo排名公司
  • 青海网站建设费用oa系统和erp系统区别
  • 个人做网站的注意事项网站开发工程师6
  • 镇江百度网站建设北京网站开发价格
  • 大岭山镇仿做网站推广计划表格
  • 网站备案地址不是我的地址怎么办建设银行网站查询业务收费吗
  • 电商网站设计内容网站编辑及seo招聘
  • 用什么网站开发浙江省住房和建设厅网站
  • 站长工具seo优化建议微信小程序线上商城怎么申请
  • 建筑网站开发设计做网站的公司msgg
  • 设计师个人网站模板网站的尾页要怎么做
  • 营销型网站建设风格设定包括哪些方面wordpress企业魔板
  • 怎样做淘客网站做绿色产品的网站