鸿蒙 HarmonyOS NEXT星河版APP应用开发阶段三-热门组件使用及案例

一、样式和结果重用

介绍

/*
@Extend:扩展组件(样式、事件)
@Styles: 抽取通用数据、事件
@Builder:自定义构建函数(结构、样式、事件)
*/

@Extend

/*
作用:扩展组件(样式、事件)
场景:两个文本组件,大部分样式类似,事件类似,抽取类似代码,定义成一个方法,将不同的内容用参数获取
*/ 
/*
语法:
@Extend(扩展的组件名)
function 自定义函数名(参数1...){
  抽取类似的样式和事件
}
*/
@Extend(Text)
function TextStyle(fontSize:number=24,textColor:string=Color.White.toString(),fontWeight:number=700){
  .fontColor(Color.Red).fontWeight(fontWeight).textAlign(TextAlign.Center)
  .backgroundColor(textColor).borderRadius(10).fontSize(fontSize)
}
@Entry
@Component
struct Index {
  build() {
    Column(){
      Swiper(){
        Text("1").TextStyle(16,"#f00",700)
        Text("1").TextStyle(34,"#ff0",700)
        Text("2").TextStyle(66,"#fff",700)
        Text("3").TextStyle(40,"#00f",700)
      }.width("100%").aspectRatio(2.4).loop(true).autoPlay(true).interval(5000).padding(2).borderRadius(10)
      .indicator(
        Indicator.dot()
          // 默认
          .itemWidth(15)
          .itemHeight(4)
          .color("#80737272")
          // 选中
          .selectedItemWidth(30)
          .selectedItemHeight(4)
          .selectedColor("#ffffffff")
      )
    }.width("100%").height("100%").backgroundColor("#ffe7dddd")

  }
}

@Styles

/* 
构建不同组件的通用样式和事件
场景:如文本和图片框宽和高都是相同的,背景颜色也是一样的,就可以用该注解
注意:@Styles不支持传递参数
*/
// 示例
@Styles
function commonStyle(){
  .width(100).height(100)
  .margin({top:10})
}
@Entry
@Component
struct Index {
  @State bgColor:string = "#f00"
  @Styles commonBgColorStyle(){
    .backgroundColor(this.bgColor)
  }
  @Styles CommonClickStyles(){
    .onClick(()=>{
      this.bgColor= "#ff0"
    })
  }
  build() {
    Column(){
        Text("文本1").commonStyle().commonBgColorStyle().CommonClickStyles()
        Text("文本2").commonStyle().commonBgColorStyle().CommonClickStyles()
        Text("文本3").commonStyle().commonBgColorStyle().CommonClickStyles()
        Image($r("app.media.hos")).commonStyle().commonBgColorStyle().CommonClickStyles()
    }.width("100%").height("100%").backgroundColor("#ffe7dddd")

  }
}

image.png

@Builder

/*
@Builder:自定义构建函数(结构、样式、事件)
注意:想使用状态变量,定义为局部的Builder
*/
@Extend(Column)
function ColumnExtend(color:ResourceColor){
  .width("100%").height("100%").backgroundColor(color)
}
@Builder
function itemTab(src:ResourceStr,title:string){
  Column(){
    Image(src).width(20)
    Text(title).fontSize(14).margin({top:5})
  }.layoutWeight(1)
}
@Entry
@Component
struct Index {
  @State bgColor:ResourceColor = "#fff68f8f"
  @Builder
   itemTab(src:ResourceStr,title:string, bgColor:ResourceColor){
  Column(){
    Image(src).width(20)
    Text(title).fontSize(14).margin({top:5})
  }.layoutWeight(1).onClick(()=>{
    // 点击切换Column颜色
    this.bgColor = bgColor
  })
}
  build() {
    Column(){
      Stack({alignContent:Alignment.Bottom}){
        Column().ColumnExtend(this.bgColor)
        Row(){
          // 全局
          itemTab($r("app.media.zfb_tab_home"),"")
          itemTab($r("app.media.zfb_tab_money"),"支付宝")
          // 局部
          this.itemTab($r("app.media.zfb_tab_chat"),"聊天","#fff6d6d6")
          this.itemTab($r("app.media.zfb_tab_me"),"我的","#ffca0c0c")

        }.width("100%").height(60).backgroundColor(Color.White)

      }.width("100%").height("100%")

    }.ColumnExtend("#ffb7b7b7")

  }
}

image.png

二、组件

Swiper轮图

  • 基本语法
/*
Swiper(){
  //内容
}.width("100%")
  .height(100)
  */

@Entry
@Component
struct Index {

  build() {
    Column(){
      Swiper(){
        Text("1").backgroundColor(Color.Red).textAlign(TextAlign.Center)
        Text("1").backgroundColor(Color.Yellow).textAlign(TextAlign.Center)
        Text("1").backgroundColor(Color.Gray).textAlign(TextAlign.Center)
        Text("1").backgroundColor(Color.Orange).textAlign(TextAlign.Center)
        
      }.width("100%").height(200)
    }.width("100%").height("100%").backgroundColor("#fffdd1d1")

  }
}
  • 效果

image.png

  • 常用属性
/*
是否开启循环:loop(boolean)true
是否自动播放:autoPlay(boolean)false
自动播放时间间隔:interval(number)3000
纵向滚动轮播:vertical(boolean)false
*/
// 功能:每隔5秒纵向自动播放图片
@Entry
@Component
struct Index {

  build() {
    Column(){
      Swiper(){
       Image($r("app.media.hw"))
        Image($r("app.media.hos"))

      }.width("100%").height(200).loop(true).autoPlay(true).interval(5000).vertical(true)
    }.width("100%").height("100%").backgroundColor("#fffdd1d1")

  }
}

image.png

  • 小圆点样式自定义

image.png

Scroll滚动

  • 作用:当子组件的长度超过scroll,内容就可以滚动了。
  • 核心用法
/*
基本参数:
滚动方向:默认纵向
scroll组件中,只支持一个子组件
需要设置scroll的尺寸
扩展:
快速创建任意长度的数组:Array.from({length:长度})
*/
@Extend(Column)
function ColumnExtend(color:ResourceColor){
  .width("100%").height("100%").backgroundColor(color)
}
@Builder
function TextItem(title:string){
  Text(title).borderRadius(10).textAlign(TextAlign.Center).padding(10).width("100%")
    .height(100).backgroundColor("#fff8a9a9")


}
@Entry
@Component
struct Index {
  build() {
    Column(){
      Scroll() {
        Column({ space: 10 }) {
          ForEach(Array.from({ length: 10 }), (item: string, index) => {
            TextItem((index + 1).toString())
          })
        }
       .width("100%").padding(10)
      }.width("100%").height("100%")
    }.ColumnExtend("#ffffffff")

  }
}

image.png

  • 常见属性
  • image.png
@Extend(Column)
function ColumnExtend(color:ResourceColor){
  .width("100%").height("100%").backgroundColor(color)
}
@Builder
function TextItem(title:string){
  Text(title).borderRadius(10).textAlign(TextAlign.Center).padding(10).width("100%")
    .height(100).backgroundColor("#fff8a9a9")


}
@Entry
@Component
struct Index {
  build() {
    Column(){
      Scroll() {
        Column({ space: 10 }) {
          ForEach(Array.from({ length: 10 }), (item: string, index) => {
            TextItem((index + 1).toString())
          })
        }
       .width("100%").padding(10)
      }.width("100%").height("100%")
      .scrollBar(BarState.Auto) // 滑动显示,不滑动隐藏
      .scrollBarColor(Color.Black) // 滚动条颜色
      .scrollBarWidth(2) // 滚动条宽度
      .edgeEffect(EdgeEffect.Spring) // 弹框效果

    }.ColumnExtend("#ffffffff")

  }
}

image.png

  • 控制器
/*
使用步骤:
1 实例化Scroller控制器  ( new 一个scroll对象)
2 绑定给Scroll组件
3 控制器方法控制滚动,属性控制距离
*/

import { AlertDialog } from '@ohos.arkui.advanced.Dialog'

@Extend(Column)
function ColumnExtend(color:ResourceColor){
  .width("100%").height("100%").backgroundColor(color)
}
@Builder
function TextItem(title:string){
  Text(title).borderRadius(10).textAlign(TextAlign.Center).padding(10).width("100%")
    .height(100).backgroundColor("#fff8a9a9")


}
@Entry
@Component
struct Index {
  scroll:Scroller= new Scroller() // 步骤一:new Scroller对象
  build() {
    Column(){
      
      Scroll(this.scroll) { // 2 绑定
        Column({ space: 10 }) {
          ForEach(Array.from({ length: 20 }), (item: string, index) => {
            TextItem((index + 1).toString())
          })
        }
       .width("100%").padding(10)
      }.width("100%").height("100%")
      .scrollBar(BarState.Auto) // 滑动显示,不滑动隐藏
      .scrollBarColor(Color.Black) // 滚动条颜色
      .scrollBarWidth(2) // 滚动条宽度
      .edgeEffect(EdgeEffect.Spring) // 弹框效果
      Image($r("app.media.ic_shangjiantou")).width(30).border({width:1,color:Color.Black}).borderRadius(15)
        .padding(5).position({
        x:290,y:700
      }).zIndex(999).onClick(()=>{
        this.scroll.scrollEdge(Edge.Top)
      })


    }.ColumnExtend("#ffffffff")

  }
}

image.png

  • 事件
/*
onScroll((x,y)=>{
// 滚动时,实时触发,
})
*/

Tabs

  • 基本使用
/*
TabContent(){} 内只能有一个字组件
*/

@Extend(Column)
function ColumnExtend(color:ResourceColor){
  .width("100%").height("100%").backgroundColor(color)
}

@Entry
@Component
struct Index {

  build() {
    Column(){
      Tabs(){

        TabContent(){
          Text("首页") // 子组件只能有一个
        }.tabBar("首页")
        TabContent(){
          Text("推荐")
        }.tabBar("推荐")
        TabContent(){
          Text("发现")
        }.tabBar("发现")
        TabContent(){
          Text("我的")
        }.tabBar("我的")


      }

    }.ColumnExtend("#ffffffff")

  }
}

image.png

  • 常用属性
  • image.png
/*
第一个配置使用参数形式,其余都是属性方法
*/ 
import { AlertDialog } from '@ohos.arkui.advanced.Dialog'

@Extend(Column)
function ColumnExtend(color:ResourceColor){
  .width("100%").height("100%").backgroundColor(color)
}

@Entry
@Component
struct Index {

  build() {
    Column(){
      Tabs({barPosition:BarPosition.End}){

        TabContent(){
          Text("首页") // 子组件只能有一个
        }.tabBar("首页")
        TabContent(){
          Text("推荐")
        }.tabBar("推荐")
        TabContent(){
          Text("发现")
        }.tabBar("发现")
        TabContent(){
          Text("我的")
        }.tabBar("我的")


      }.scrollable(true) // 手滑
      .animationDuration(0) // 动画

    }.ColumnExtend("#ffffffff")

  }
}

image.png

  • 滚动导航栏
/*
添加属性:.barMode(BarMode.Scrollable)
*/
@Extend(Column)
function ColumnExtend(color:ResourceColor){
  .width("100%").height("100%").backgroundColor(color)
}

@Entry
@Component
struct Index {

  build() {
    Column(){
      Tabs({barPosition:BarPosition.Start}){
      ForEach(Array.from({length:100}),(item:string,index)=>{
          TabContent(){
            Text(index.toString())
          }.tabBar(index.toString())
      })
      }.scrollable(true) // 手滑
      .animationDuration(0) // 动画
      .barMode(BarMode.Scrollable)
    }.ColumnExtend("#ffffffff")


  }
}

image.png

  • 自定义TabBar栏
/*
基础结构
自定义导航栏就是使用@Builder重新编写导航栏组件

*/ 

二、案例

生肖抽卡

扩展知识

Badge角标组件
  • 语法
@Entry
@Component
struct Index {
  build() {
    Column(){
    Badge({
      count:111, // 次数,超过100 变为99+
      position:BadgePosition.RightTop, // 三个方向:
      style:{ // 角标样式
        fontSize:12,
        fontWeight:700,
        badgeColor:Color.Red
    }
    }){
      Image($r("app.media.hos")).width(200).borderRadius(10)
    }
    }.width("100%").height("100%").backgroundColor("#ffe3dfdf").padding(15)


  }
}
  • 效果

image.png

Grid布局
  • 场景:常用于 有规则的布局
  • 语法:
@Entry
@Component
struct Index {
  build() {
    Column(){
    Grid(){
        ForEach([0,1,2,3,4,5],(item:number,index)=>{
          GridItem(){
            Image($r(`app.media.img_0${item}`)).width(80)
          }
        })
    }.width("100%").height(300)
      .rowsTemplate("1fr 1fr").columnsTemplate("1fr 1fr 1fr")
      .margin({top:100})
      .padding(25)
      Button("立即抽奖").width(200).backgroundColor("#fff66363")
    }

  }
}
  • 效果:

image.png

涉及知识点及注意点
// 知识
1.badge角标组件
2.grid布局,stack布局
3.数组对象动态渲染,动态更新
4.遮罩层动画,图像动画效果animation
5.随机抽奖math.random,math.floor
6.假设成立法,判断是否中奖
// 注意点:
鸿蒙对象数组在修改某一个对象的值时,需要将整个对象重新赋值页面才会重新渲染新数据。

image.png

实现效果图

image.png

代码
interface Animal{
   id:number,
   name:string,
   goodNum:number,
  url:string, url1:string
}
@Entry
@Component
struct Index {
@State pageStatus:number=0
  @State pagw2Title:string= "获取的生肖卡"
  @State randomNum:number=0
  @State sum:number=0
@State animals:Animal[]=[
  { id:1, name:"龙", goodNum:0, url:"app.media.img_00" ,url1:"app.media.bg_00"},
  { id:2, name:"马", goodNum:0, url:"app.media.img_01" ,url1:"app.media.bg_01"},
  { id:3, name:"蛇", goodNum:0, url:"app.media.img_02" ,url1:"app.media.bg_02"},
  { id:4, name:"牛", goodNum:0, url:"app.media.img_03" ,url1:"app.media.bg_03"},
  { id:5, name:"虎", goodNum:0, url:"app.media.img_04",url1:"app.media.bg_04"},
  { id:6, name:"兔", goodNum:0, url:"app.media.img_05" ,url1:"app.media.bg_05"}
]
  build() {
   Stack(){

     // page1
       Column(){
         Grid(){
           ForEach(this.animals,(item:Animal,index)=>{
             GridItem(){
               Badge({
                 count:item.goodNum,
                 position:BadgePosition.RightTop,
                 style:{
                   fontSize:12,
                   badgeSize:20,
                   badgeColor:Color.Red
                 }
               }){
                 Image($r(item.url1)).width(80)
               }
             }
           })
         }.width("100%").height(300)
         .rowsTemplate("1fr 1fr").columnsTemplate("1fr 1fr 1fr")
         .margin({top:100})
         .padding(25)

         Button("立即抽奖").width(200).backgroundColor("#fff66363").onClick(()=>{
           this.sum=0
           for (let item of this.animals) {
             if (item.goodNum > 0) {
               this.sum+=1
             }

           }
           if(this.sum==6){
             this.pageStatus=2
             this.pagw2Title= `恭喜获得手机一台`

           }else{
             this.pageStatus = 1
             this.randomNum = Math.floor(Math.random()*6)
             console.log("result=>>",this.randomNum)
             this.pagw2Title= `获取生肖${this.animals[this.randomNum].name}卡`
           }


         })
       }.width("100%").height("100%")

     if(this.pageStatus==1){
       //page2
       Column({space:30}){
         Text(this.pagw2Title).fontSize(24).fontWeight(700).fontColor("#ffe3d7b2")
         Image($r(this.animals[this.randomNum].goodNum==0?this.animals[this.randomNum].url:this.animals[this.randomNum].url1)).width(200)
           Button("开心收下").width(160).backgroundColor(Color.Transparent)
             .border({width:2,color:"#ffd0cdcd"}).onClick(()=>{
             this.pageStatus= 0
             this.animals[this.randomNum]={
               id:this.randomNum+1,
               name:  this.animals[this.randomNum].name,
               goodNum:  this.animals[this.randomNum].goodNum+1
             , url:"app.media.img_0" +this.randomNum
             ,url1:"app.media.img_0"+this.randomNum
             }
             // this.animals[this.randomNum].url=  this.animals[this.randomNum].url1
             console.log( JSON.stringify( this.animals[this.randomNum]))
          //   this.animals=this.animals
           })
       }.width("100%").height("100%").backgroundColor("#cc000000").justifyContent(FlexAlign.Center)

     }else if(this.pageStatus==2){
       //page3
       Column({space:30}){
         Text(this.pagw2Title).fontSize(24).fontWeight(700).fontColor("#ffe3d7b2")
         Image($r("app.media.xm")).width(400)
         Button("再来一次").width(160).backgroundColor(Color.Transparent)
           .border({width:2,color:"#ffd0cdcd"}).onClick(()=>{
           this.pageStatus= 0

           this.animals=

             [
               { id:1, name:"龙", goodNum:0, url:"app.media.img_00" ,url1:"app.media.bg_00"},
               { id:2, name:"马", goodNum:0, url:"app.media.img_01" ,url1:"app.media.bg_01"},
               { id:3, name:"蛇", goodNum:0, url:"app.media.img_02", url1:"app.media.bg_02"},
               { id:4, name:"牛", goodNum:0, url:"app.media.img_03" ,url1:"app.media.bg_03"},
               { id:5, name:"虎", goodNum:0, url:"app.media.img_04", url1:"app.media.bg_04"},
               { id:6, name:"兔", goodNum:0 ,url:"app.media.img_05" ,url1:"app.media.bg_05"}
             ]

         })
       }.width("100%").height("100%").backgroundColor("#cc000000").justifyContent(FlexAlign.Center)

     }






   }

  }
}

小米轮播

  • 实现效果
/*
宽高比=宽/高
属性:aspectRatio()

  */ 

@Entry
@Component
struct Index {
  build() {
    Column(){
      Swiper(){
        Image($r("app.media.ic_swiper_xmyp01")).borderRadius(10)
        Image($r("app.media.ic_swiper_xmyp02")).borderRadius(10)
        Image($r("app.media.ic_swiper_xmyp03")).borderRadius(10)
        Image($r("app.media.ic_swiper_xmyp04")).borderRadius(10)
      }.width("100%").aspectRatio(2.4).loop(true).autoPlay(true).interval(5000).padding(2).borderRadius(10)
      .indicator(
        Indicator.dot()
          // 默认
          .itemWidth(15)
          .itemHeight(4)
          .color("#80737272")
          // 选中
          .selectedItemWidth(30)
          .selectedItemHeight(4)
          .selectedColor("#ffffffff")
      )

    }.width("100%").height("100%").backgroundColor("#ffe7dddd")

  }
}

image.png

点图标回到顶部

import { AlertDialog } from '@ohos.arkui.advanced.Dialog'

@Extend(Column)
function ColumnExtend(color:ResourceColor){
  .width("100%").height("100%").backgroundColor(color)
}
@Builder
function TextItem(title:string){
  Text(title).borderRadius(10).textAlign(TextAlign.Center).padding(10).width("100%")
    .height(100).backgroundColor("#fff8a9a9")


}
@Entry
@Component
struct Index {
  @State status :boolean =false
  scroll:Scroller= new Scroller() // 步骤一:new Scroller对象
  build() {
    Column(){

      Scroll(this.scroll) { // 2 绑定
        Column({ space: 10 }) {
          ForEach(Array.from({ length: 20 }), (item: string, index) => {
            TextItem((index + 1).toString())
          })
        }
       .width("100%").padding(10)
      }.width("100%").height("100%")
      .scrollBar(BarState.Auto) // 滑动显示,不滑动隐藏
      .scrollBarColor(Color.Black) // 滚动条颜色
      .scrollBarWidth(2) // 滚动条宽度
      .edgeEffect(EdgeEffect.Spring) // 弹框效果
      .onScroll((x,y)=>{

        if(this.scroll.currentOffset().yOffset>150){
          this.status = true
        }else{
          this.status=false
        }

      })
      if(this.status){
        Image($r("app.media.ic_shangjiantou")).width(30).border({width:1,color:Color.Black}).borderRadius(15)
          .padding(5).offset({x:110,y:-50}).zIndex(999).onClick(()=>{
          this.scroll.scrollEdge(Edge.Top)
        })
      }
    }.ColumnExtend("#ffffffff")

  }
}
  1. 实现效果:
    1. 滚动到大于150显示图标,点击图标滚动到最顶部

image.png
image.png

自定义导航栏切换

效果:点击导航标题时,切换到对应的页面,并修改当前页面导航的状态。

@Entry
@Component
struct Index {
  @State iconIndex:number = 0
  @Builder
  centerBuilder(){
    Image($r("app.media.flower")).width(40)
  }
  @Builder
  tabBarItem(numIndex:number,title:string,icon:ResourceStr,selectIcon:ResourceStr){
    Column(){
      Image(this.iconIndex==numIndex? icon :selectIcon).width(30)
      Text(title).fontColor(this.iconIndex==numIndex? "#ffe99607" :Color.Black)
    }
  }
  build() {
      Tabs({barPosition:BarPosition.End}){
        TabContent(){
          Text("内容1")
        }.tabBar(this.tabBarItem(0,"首页",$r("app.media.ic_tabbar_icon_0_selected"),$r("app.media.ic_tabbar_icon_0")))
        TabContent(){
          Text("内容2")
        }.tabBar(this.tabBarItem(1,"分类",$r("app.media.ic_tabbar_icon_1_selected"),$r("app.media.ic_tabbar_icon_1")))

        TabContent(){
          Text("内容3")
        }.tabBar(this.centerBuilder())
        TabContent(){
          Text("内容4")
        }.tabBar(this.tabBarItem(3,"购物车",$r("app.media.ic_tabbar_icon_1_selected"),$r("app.media.ic_tabbar_icon_2")))
        TabContent(){
          Text("内容5")
        }.tabBar(this.tabBarItem(4,"我的",$r("app.media.ic_tabbar_icon_3_selected"),$r("app.media.ic_tabbar_icon_3")))
      }
    .onChange((index)=>{
        this.iconIndex= index
    })

  }
}

image.png

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/745438.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

C语言 | Leetcode C语言题解之第189题轮转数组

题目&#xff1a; 题解&#xff1a; void swap(int* a, int* b) {int t *a;*a *b, *b t; }void reverse(int* nums, int start, int end) {while (start < end) {swap(&nums[start], &nums[end]);start 1;end - 1;} }void rotate(int* nums, int numsSize, int…

JavaScript创建标签式组件

我们本篇将实现下面的这个标签式组件 我们本篇将实现下面的这个标签式组件 ● 当然我们首先将我们需要的元素存储到变量中&#xff0c;方便后面使用 const tabs document.querySelectorAll(.operations__tab); //获取所有的button const tabsContainer document.querySele…

ROS CDK魔法书:点亮博客上云新技能(Python篇)

引言 在数字世界的浩瀚海洋中&#xff0c;信息与数据如同戏剧中的主角&#xff0c;舞动着无形的旋律&#xff0c;构建起信息时代的交响乐。而在这其中&#xff0c;作为一位技术领域的探索者&#xff0c;你的使命便是挥舞着编码的魔杖&#xff0c;创造和守护着这些宝贵的数字灵…

外贸邮件推送有哪些策略?如何提升转化率?

外贸邮件推送的效果怎么优化&#xff1f;邮件推送的技巧有哪些&#xff1f; 外贸邮件推送是一种有效的市场营销策略&#xff0c;可以帮助企业开拓国际市场&#xff0c;增加销售额。然而&#xff0c;成功的外贸邮件推送并不是一蹴而就的&#xff0c;需要精心策划和执行。AokSen…

【RF Transceiver】ADRV9040 THEORY OF OPERATION

工作原理 概述 GENERAL 该 ADRV9040 是一款高度集成的射频收发器&#xff0c;能够针对各种应用进行配置。该器件集成了在单个器件中提供所有发射器、流量接收机和观测接收机功能所需的所有射频、混合信号和数字模块。可编程性使该器件能够适应 TDD 模式下的许多 3G/4G/5G 蜂窝…

“论大数据处理架构及其应用”高分范文,软考高级,系统架构设计师

论文真题 大数据处理架构是专门用于处理和分析巨量复杂数据集的软件架构。它通常包括数据收集、存储、处理、分析和可视化等多个层面&#xff0c;旨在从海量、多样化的数据中提取有价值的信息。Lambda架构是大数据平台里最成熟、最稳定的架构&#xff0c;它是一种将批处理和流…

vue3使用vant4的列表vant-list点击进入详情自动滚动到对应位置,踩坑日记(一天半的踩坑经历)

1.路由添加keepAlive <!-- Vue3缓存组件&#xff0c;写法和Vue2不一样--><router-view v-slot"{ Component }"><keep-alive><component :is"Component" v-if"$route.meta.keepAlive"/></keep-alive><component…

20240626每日AI-----------创建你的第一个文心智能体平台Agent

载体 文心智能体平台Agent 注册 统一使用百度账户登录即可 创建智能体 登录后即可在左边菜单进行点击&#xff0c;创建智能体。 创建官方智能体 编写你的智能体名称等等信息

迅为RK3588开发板支持LVDS信号,标准 HDMI信号,IMIPI信号

性能强--iTOP-3588开发板采用瑞芯微RK3588处理器&#xff0c;是全新一代ALoT高端应用芯片&#xff0c;采用8nm LP制程&#xff0c;搭载八核64位CPU&#xff0c;四核Cortex-A76和四核Cortex-A55架构&#xff0c;主频高达2.4GHZ&#xff0c;8GB内存&#xff0c;32GB EMMC。 四核心…

【C++】关于虚函数的理解

深入探索C虚函数&#xff1a;原理、应用与实例分析 一、虚函数的原理二、虚函数的应用三、代码实例分析四、总结 在C面向对象编程的世界里&#xff0c;虚函数&#xff08;Virtual Function&#xff09;扮演着至关重要的角色。它不仅实现了多态性这一核心特性&#xff0c;还使得…

云层区分神经网络模型——二分类

云层区分神经网络模型——二分类 问奶奶&#xff0c;是什么让他们维护一份感情长达年&#xff0c;奶奶说那个年代什么东西坏了都会想要修&#xff0c;现在什么坏了都想着换。 安装依赖 # 要运行脚本&#xff0c;请先安装以下库&#xff1a;pip install tensorflowpip install …

健康管理系统

摘 要 随着现代社会生活节奏的加快和工作压力的增大&#xff0c;人们对健康管理的需求日益凸显。传统的健康管理方式&#xff0c;如定期体检、手动记录健康数据等&#xff0c;已经无法满足现代人对健康管理的即时性、全面性和个性化需求。因此&#xff0c;开发一款高效、便捷的…

Docker三分钟部署ElasticSearch平替MeiliSearch轻量级搜索引擎

&#x1f469;&#x1f3fd;‍&#x1f4bb;个人主页&#xff1a;阿木木AEcru (更多精彩内容可进入主页观看) &#x1f525; 系列专栏&#xff1a;《Docker容器化部署系列》 《Java每日面筋》 &#x1f4b9;每一次技术突破&#xff0c;都是对自我能力的挑战和超越。 目录 一、 …

Topaz Gigapixel AI图片无损放大软件下载安装,Topaz Gigapixel AI 高精度的图片无损放大

Topaz Gigapixel AI无疑是一款革命性的图片无损放大软件&#xff0c;它在图像处理领域开创了一种全新的可能性。 Topaz Gigapixel AI的核心功能在于能够将图片进行高精度的无损放大。虽然经过软件处理的图片严格意义上并不能算是完全无损&#xff0c;但相较于传统方法&#xf…

一、什么是缓存穿透、缓存击穿、缓存雪崩

1、为啥使用缓存&#xff1f; 在程序内部使用缓存&#xff0c;将经常使用的数据存储在缓存中&#xff0c;可以减少对数据库的频繁访问&#xff0c;从而提高系统的响应速度和性能。缓存可以将数据保存在内存中&#xff0c;读取速度更快&#xff0c;能够大大缩短数据访问的时间&…

uniapp——上传图片获取到file对象而非临时地址——基础积累

最近在看uniapp的代码&#xff0c;遇到一个需求&#xff0c;就是要实现上传图片的功能 uniapp 官网地址&#xff1a;https://uniapp.dcloud.net.cn/ 上传图片有对应的API&#xff1a; uni.chooseImage方法&#xff1a;https://uniapp.dcloud.net.cn/api/media/image.html#choo…

【Python机器学习】分类向量——数字可以编码分类变量

在adult数据集的例子中&#xff0c;分类变量被编码为字符。一方面可能会有拼写错误&#xff0c;但另一方面&#xff0c;它明确的将一个变量标记为分类变量。无论是为了便于存储还是因为数据的手机方式&#xff0c;分类变量通常被编码为整数。 假设adult数据集中的人口普查数据…

windows系统根据端口查询pid并结束进程 netstat taskkill

用管理员权限打开命令指示符,输入命令&#xff1a; 1、查看被占用端口所对应的 PID netstat -aon|findstr “端口号” 2、查看指定PID的进程 tasklist|findstr ”14816” 3、结束进程 taskkill -pid 进程号 -f

秋招突击——6/24——复习{完全背包问题——买书,状态转换机——股票买卖V}——新作{两数相除,LRU缓存实现}

文章目录 引言复习完全背包问题——买书个人实现 状态转换机——股票买卖V个人实现参考实现 新作两数相除个人实现 新作LRU缓存实现个人实现unordered_map相关priority_queue相关 参考实现自己复现 总结 引言 今天知道拼多多挂掉了&#xff0c;难受&#xff0c;那实习就是颗粒无…

4_FOC之Clarke变换原理及推导_1

三相PMSM的数学模型是一个比较复杂且强耦合的多变量系统。为了便于后期控制器设计&#xff0c;必须选择合适的坐标变换对数学模型进行降阶和解耦变换。 1、什么是Clark变换 静止abc轴系与αβ轴系如上图。为满足功率不变约束&#xff0c;在图中设αβ轴系中定子绕组以及转子绕组…
最新文章