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

新网站制作市场重庆网站设计建设

新网站制作市场,重庆网站设计建设,河源东源新闻最新消息,自己创建平台型网站摘要: 图片组件(A_Image):可设置图片地址、图片宽度、图片高度、圆角类型及是否显示外框线。圆角类型支持普通圆角、圆形及无圆角。 一、组件调用方式 1.极简调用 只需要输入A_Image,然后给src(图片地址)属性赋值即可…

摘要:

图片组件(A_Image):可设置图片地址、图片宽度、图片高度、圆角类型及是否显示外框线。圆角类型支持普通圆角、圆形及无圆角。

一、组件调用方式

1.极简调用

只需要输入A_Image,然后给src(图片地址)属性赋值即可。默认宽度和高度均为300vp,方角。

2.更多属性

输入A_Image,然后给src(图片地址)属性赋值,可设置图片宽度(imageWidth)、图片高度(imageHeight)、圆角类型(radius)和使用外框线(imageOutline)。

3.圆形图片

输入A_Image,然后给src(图片地址)属性赋值,可设置图片宽度(imageWidth),将圆角类型 radius设置为 circle(圆形)。如下图所示:

页面调用代码如下:

  GridCol({ span: 4 }) {A_Image({src: 'https://cdn.aigcoder.com/sample/Image/image1.jpeg',imageWidth: 300,imageHeight: 300,})}GridCol({ span: 4 }) {A_Image({src: 'https://cdn.aigcoder.com/sample/Image/image4.jpeg',imageWidth: 240,imageHeight: 160,radius: 'radius',imageOutline: true})}GridCol({ span: 4 }) {A_Image({src: 'https://cdn.aigcoder.com/sample/Image/image2.jpeg',imageWidth: 120,imageHeight: 300,radius: 'circle',})}

本地模拟器下浅色模式和深色模式运行效果如下:

二、在线排版

1.极简调用

1.1、将图片组件拖拽到页面排版区

1.2、设置图片地址

1.3、保存设置

2.更多属性

2.1、将图片组件拖拽到页面排版区

2.2、设置图片地址、宽度、高度、圆角类型、显示外框线

2.3、保存设置

3.圆形图片

3.1、将图片组件拖拽到页面排版区

3.2、设置宽度,圆角设置为圆形

3.3、保存设置

生成纯血鸿蒙代码:

三、组件源码

图片组件的完整源码如下:

/** Copyright (c) 2024 AIGCoder.com(AI极客)* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**     http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*//**调用示例一:极简调用A_Image({src: 'https://cdn.aigcoder.com/sample/Image/image1.jpeg'})调用示例二:更多属性A_Image({src: 'https://cdn.aigcoder.com/sample/Image/image4.jpeg',imageWidth: 300,imageHeight: 200,radius: 'radius',imageOutline: true})*/import { ColorConstants } from "../../constants/ColorConstants"
import { FloatConstants } from "../../constants/FloatConstants"
import { GirdConstants } from "../../constants/GirdConstants"/*** 【图片】* src:图片地址(支持远程图片和本地资源)* imageWidth:图片宽度* imageHeight:图片高度* radius:圆角类型(支持radius,circle,normal)* imageOutline:是否显示外框线*/
@Component
export struct A_Image {@Prop src: string = ''@Prop imageWidth?: number@Prop imageHeight?: number@Prop radius?: string = 'normal'@Prop imageOutline?: boolean = false@State compWidth: number = 150@State compHeight: number = 150aboutToAppear(): void {if(this.imageWidth !== undefined){this.compWidth = this.imageWidth}if(this.imageHeight !== undefined){this.compHeight = this.imageHeight}if(!(this.src.startsWith("http://") || this.src.startsWith("https://"))){this.src = this.src === '' ? 'app.media.mdi_image' : 'app.media.' + this.src}}build() {Flex({justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center}){Image((this.src.startsWith("http://") || this.src.startsWith("https://")) ? this.src : $r(this.src)).width(GirdConstants.FULL_PERCENT).height(GirdConstants.FULL_PERCENT).objectFit(ImageFit.Cover).opacity((this.src === '') ? 0.6 : 1).borderRadius((this.radius == 'radius') ? FloatConstants.RADIUS_ICON : ((this.radius == 'circle') ? this.compWidth/2 : 0))}.width(this.compWidth).height(this.radius == 'circle' ? this.compWidth : this.compHeight).padding(this.imageOutline ? FloatConstants.SPACE_S : 0).backgroundColor(ColorConstants.CARD_BG).borderRadius((this.radius == 'radius') ? FloatConstants.RADIUS_ICON : ((this.radius == 'circle') ? this.compWidth/2 : 0))}
}

四、资源下载 

AIGCoder.com-AI极客

    http://www.dtcms.com/a/399789.html

    相关文章:

  1. 大模型灾难性的原因和缓解方法?
  2. 【深度学习-Day 49】注意力机制:让模型像人一样“划重点”,告别Seq2Seq信息瓶颈
  3. 网站建设团队管理模板开发者导航
  4. 2025年APP安全防护终极指南:从逆向破解到全面防御
  5. 古交网站建设最好的app制作公司
  6. 做公司网站wordpress二级目录安装
  7. Android启动优化
  8. 中学生旅游网站开发的论文怎么写口碑营销理论
  9. 整站seo优化公司浙江seo
  10. 上传网站步骤wordpress调用小工具
  11. 学了网站建设的心得体会最好设计网站建设
  12. 上海信息公司做网站软件开发需要学什么专业好
  13. 网站页面设计效果图江苏网站seo平台
  14. 网站做细分领域客户管理系统网站
  15. 网站开发建设费用外国高端网站
  16. 电商资讯网站有哪些茶文化网站制作
  17. Vue前端用什么开发工具?Vue前端开发常用工具推荐、Vue开发工具对比与最佳实践分享
  18. 网站网站制作网站营销最好的方法
  19. linux安装hbase(完)
  20. S7-200 SMART PLC 以太网通信详解:3 种方式从原理到实操
  21. 岳阳做网站 公司电话做农产品的网站名称
  22. 我们公司在做网站推广莱芜百度推广电话
  23. leetcode(填充每个节点的下一个右侧节点指针 II)
  24. 如何提高网站在搜索引擎中的排名wordpress主题有后台
  25. 展厅讲解机器人如何选?AI大模型是关键
  26. 做网站找沈阳横纵网络通辽网站制作公司
  27. PyTorch深度学习实战【12】之基于RNN的自然语言处理入门
  28. 【超详细图文教程】Windows 系统 Go 语言环境安装与配置详细教程​
  29. 广州网站制作实力乐云seo网站开发知识视频教程
  30. hive架构及搭建