鸿蒙案例---生肖抽卡

news2025/4/19 7:00:13

案例源码:

Zodiac_cards: 鸿蒙生肖抽奖卡片

效果演示

初始布局

1. Badge 角标组件

此处为语雀内容卡片,点击链接查看:https://www.yuque.com/kevin-nzthp/lvl039/rccg0o4pkp3v6nua

2. Grid 布局

// 定义接口
interface ImageCount {
  url: ResourceStr,
  count: number
}

@Entry
  @Component
  struct Index {
    @State images: ImageCount[] = [
      { url: '/images/bg_00.png', count: 0 },
      { url: '/images/bg_01.png', count: 1 },
      { url: '/images/bg_02.png', count: 2 },
      { url: '/images/bg_03.png', count: 3 },
      { url: '/images/bg_04.png', count: 4 },
      { url: '/images/bg_05.png', count: 5 },
    ]

    // 控制遮罩的显隐
    @State maskOpacity: number = 0 // 透明度
    @State maskIndex: number = -1; // 显示层级

    // 控制图片的缩放
    @State maskImgX: number = 0 // 水平缩放比
    @State maskImgY: number = 0 // 垂直缩放比

    build() {
      Stack() {
        Column() {
          Grid() {
            ForEach(this.images, (item: ImageCount) => {
              GridItem() {
                Badge({
                  count: item.count,
                  position: BadgePosition.RightTop,
                  style: {
                    badgeSize: this.maskImgX,
                    fontSize: this.maskImgY
                  }
                }) {
                  Image(item.url)
                    .width(80)
                }
              }
            })
          }
          .rowsTemplate('1fr 1fr')
            .columnsTemplate('1fr 1fr 1fr')
            .width('100%')
            .height(300)
            .margin({ top: 100 })


          Button('立即抽卡')
            .width(200)
            .backgroundColor('#ed5b8c')
            .margin({ top: 50 })
            .onClick(()=>{
              // 点击时,修改遮罩参数,让遮罩显示
              this.maskOpacity = 1
              this.maskIndex = 99
              // 图片需要缩放
              this.maskImgX = 1
              this.maskImgY = 1
            })

        }
        .width('100%')
          .height('100%')
          .backgroundColor(Color.Pink)

        // 抽卡遮盖层
        Column({space: 30}) {
          Text('获得生肖卡')
            .fontColor('#f5ebcf')
            .fontSize(25)
            .fontWeight(FontWeight.Bold)
          Image('/images/img_00.png')
            .width(200)
            //控制元素的缩放
            .scale({
              x: this.maskImgX,
              y: this.maskImgY
            })

          Button('开心收下')
            .width(200)
            .height(50)
            .backgroundColor(Color.Transparent)
            .border({ width: 2 ,color:'#fff9e0'})
            .onClick(()=>{
              // 控制弹层显隐
              this.maskOpacity = 0
              this.maskIndex = -1
              // 重置缩放比为0,便于下一次进行缩放
              this.maskImgX = 0
              this.maskImgY = 0
            })
        }
        .justifyContent(FlexAlign.Center)
          .width('100%')
          .height('100%')
          .backgroundColor('#cc000000')
          // 设置透明度
          .opacity(this.maskOpacity)
          .zIndex(this.maskIndex)
          // 动画 animation 当我们元素有状态的改变,可以添加animation做动画
          .animation({
            duration: 500
          })
      }
    }
  }

抽卡遮罩层

静态页面

点击立即抽卡按钮后,会进入遮罩层,显示抽取的卡片,此时抽卡的页面转换为背景图,使用层叠布局

// 定义图片接口
interface ImageCount {
  url: ResourceStr,
  count: number
}

@Entry
  @Component
  struct Index {
    // 定义图片渲染数组
    @State images: ImageCount[] = [
      { url: '/images/bg_00.png', count: 0 },
      { url: '/images/bg_01.png', count: 1 },
      { url: '/images/bg_02.png', count: 2 },
      { url: '/images/bg_03.png', count: 3 },
      { url: '/images/bg_04.png', count: 4 },
      { url: '/images/bg_05.png', count: 5 },
    ]

    build() {
      Stack(){
        Column() {
          Grid() {
            ForEach(this.images, (item: ImageCount) => {
              GridItem() {
                Badge({
                  count: item.count,
                  position: BadgePosition.RightTop,
                  style: {
                    fontSize: 12,
                    badgeSize: 16
                  }
                }) {
                  Image(item.url)
                    .width(80)
                }
              }
            })
          }
          .rowsTemplate('1fr 1fr')
            .columnsTemplate('1fr 1fr 1fr')
            .height(300)
            .margin({top: 50, bottom: 50})
          // .backgroundColor(Color.Pink)

          Button('立即抽卡')
            .width(200)
            .backgroundColor('#ED5B8C')
        }

        Column({space: 30}){
          Text('获得生肖卡')
            .fontColor('#F3EAD3')
            .fontWeight(700)
            .fontSize(24)

          Image('/images/img_00.png')
            .width(200)

          Button('开心收下')
            .width(200)
            .border({
              width: 2,
              color:'#9F9C90',
            })
            .backgroundColor(Color.Transparent)
        }
        .backgroundColor('#cc000000')
          .width('100%')
          .height('100%')
          .justifyContent(FlexAlign.Center)

      }
    }
  }

抽卡遮罩层- 显隐效果控制

添加状态变量控制遮罩层 Z 轴 和 不透明度的数值.

当点击 “立即抽卡”按钮时,显示遮罩层。(此时不能隐藏)

当点击 遮罩层“开心收下”按钮时,隐藏遮罩层。

添加动画

添加遮罩层图片的缩放

效果

// 定义图片接口
interface ImageCount {
  url: ResourceStr,
  count: number
}

@Entry
  @Component
  struct Index {
    // 定义图片渲染数组
    @State images: ImageCount[] = [
      { url: '/images/bg_00.png', count: 0 },
      { url: '/images/bg_01.png', count: 1 },
      { url: '/images/bg_02.png', count: 2 },
      { url: '/images/bg_03.png', count: 3 },
      { url: '/images/bg_04.png', count: 4 },
      { url: '/images/bg_05.png', count: 5 },
    ]
    // 控制遮罩的显隐
    @State maskOpacity: number = 0 // 透明度
    @State maskIndex: number = -1; // 显示层级
    // 控制遮罩层图片的缩放
    @State maskImgScaleX: number = 0 // 水平缩放比
    @State maskImgScaleY: number = 0 // 垂直缩放比

    // 获取图片

    build() {
      Stack() {
        // 抽卡层
        Column() {
          Grid() {
            ForEach(this.images, (item: ImageCount) => {
              GridItem() {
                Badge({
                  count: item.count,
                  position: BadgePosition.RightTop,
                  style: {
                    fontSize: 12,
                    badgeSize: 16
                  }
                }) {
                  Image(item.url)
                    .width(80)
                }
              }
            })
          }
          .rowsTemplate('1fr 1fr')
            .columnsTemplate('1fr 1fr 1fr')
            .height(300)
            .margin({ top: 50, bottom: 50 })

          // .backgroundColor(Color.Pink)

          Button('立即抽卡')
            .width(200)
            .backgroundColor('#ED5B8C')
            .onClick(() => {
              // 点击时,修改遮罩参数,让遮罩显示
              this.maskOpacity = 1
              this.maskIndex = 99
              // 点击时修改遮罩层图片的缩放比
              this.maskImgScaleX = 1
              this.maskImgScaleY = 1
            })
        }

        // 遮罩层
        Column({ space: 30 }) {
          Text('获得生肖卡')
            .fontColor('#F3EAD3')
            .fontWeight(700)
            .fontSize(24)

          Image('/images/img_00.png')
            .width(200)
            .scale({
              //控制图片的缩放
              x: this.maskImgScaleX,
              y: this.maskImgScaleY
            })
            .animation({
              // 动画
              duration: 500
            })

          Button('开心收下')
            .width(200)
            .border({
              width: 2,
              color: '#9F9C90',
            })
            .backgroundColor(Color.Transparent)
            .onClick(() => {
              // 点击时,修改遮罩参数,让遮罩隐藏
              this.maskOpacity = 0
              this.maskIndex = -1
              //   // 点击时修改遮罩层图片的缩放比为1:1
              this.maskImgScaleX = 0
              this.maskImgScaleY = 0
            })
        }
        .zIndex(this.maskIndex)
          .opacity(this.maskOpacity)
          .backgroundColor('#cc000000')
          .width('100%')
          .height('100%')
          .justifyContent(FlexAlign.Center)

      }
    }
  }

随机卡片

效果演示:

要获得 0-5 的整数索引,随机抽取卡片

此时可以获取随机卡片,接下来要将抽到的随机卡片显示在主页面并右上角角标显示。

// 定义图片接口
interface ImageCount {
  url: ResourceStr,
  count: number
}

@Entry
  @Component
  struct Index {
    // 定义图片渲染数组
    @State images: ImageCount[] = [
      { url: '/images/bg_00.png', count: 0 },
      { url: '/images/bg_01.png', count: 0 },
      { url: '/images/bg_02.png', count: 0 },
      { url: '/images/bg_03.png', count: 0 },
      { url: '/images/bg_04.png', count: 0 },
      { url: '/images/bg_05.png', count: 0 },
    ]
    // 控制遮罩的显隐
    @State maskOpacity: number = 0 // 透明度
    @State maskIndex: number = -1; // 显示层级
    // 控制遮罩层图片的缩放
    @State maskImgScaleX: number = 0 // 水平缩放比
    @State maskImgScaleY: number = 0 // 垂直缩放比
    // 获取遮罩层选择的图片Index
    @State maskImgIndex: number = 0

    build() {
      Stack() {
        // 抽卡层
        Column() {
          Grid() {
            ForEach(this.images, (item: ImageCount) => {
              GridItem() {
                Badge({
                  count: item.count,
                  position: BadgePosition.RightTop,
                  style: {
                    fontSize: 12,
                    badgeSize: 16
                  }
                }) {
                  Image(item.url)
                    .width(80)
                }
              }
            })
          }
          .rowsTemplate('1fr 1fr')
            .columnsTemplate('1fr 1fr 1fr')
            .height(300)
            .margin({ top: 50, bottom: 50 })

          // .backgroundColor(Color.Pink)

          Button('立即抽卡')
            .width(200)
            .backgroundColor('#ED5B8C')
            .onClick(() => {
              // 点击时,修改遮罩参数,让遮罩显示
              this.maskOpacity = 1
              this.maskIndex = 99
              // 点击时修改遮罩层图片的缩放比
              this.maskImgScaleX = 1
              this.maskImgScaleY = 1
              //   // 随机获取图片的Index
              this.maskImgIndex = Math.floor(Math.random() * 6)
            })
        }

        // 遮罩层
        Column({ space: 30 }) {
          Text('获得生肖卡')
            .fontColor('#F3EAD3')
            .fontWeight(700)
            .fontSize(24)

          Image(`/images/img_0${this.maskImgIndex}.png`)
            .width(200)
            .scale({
              //控制图片的缩放
              x: this.maskImgScaleX,
              y: this.maskImgScaleY
            })
            .animation({
              // 动画
              duration: 500
            })

          Button('开心收下')
            .width(200)
            .border({
              width: 2,
              color: '#9F9C90',
            })
            .backgroundColor(Color.Transparent)
            .onClick(() => {
              // 点击时,修改遮罩参数,让遮罩隐藏
              this.maskOpacity = 0
              this.maskIndex = -1
              //   // 点击时修改遮罩层图片的缩放比为1:1
              this.maskImgScaleX = 0
              this.maskImgScaleY = 0
              //   开心收下
              this.images[this.maskImgIndex] = {
                url: `/images/img_0${this.maskImgIndex}.png`,
                count: this.images[this.maskImgIndex].count + 1
              }
            })
        }
        .zIndex(this.maskIndex)
          .opacity(this.maskOpacity)
          .backgroundColor('#cc000000')
          .width('100%')
          .height('100%')
          .justifyContent(FlexAlign.Center)

    }
  }
}

抽大奖遮罩层

静态页面

// 定义图片接口
interface ImageCount {
  url: ResourceStr,
  count: number
}

@Entry
@Component
struct Index {
  // 定义图片渲染数组
  @State images: ImageCount[] = [
    { url: '/images/bg_00.png', count: 0 },
    { url: '/images/bg_01.png', count: 0 },
    { url: '/images/bg_02.png', count: 0 },
    { url: '/images/bg_03.png', count: 0 },
    { url: '/images/bg_04.png', count: 0 },
    { url: '/images/bg_05.png', count: 0 },
  ]
  // 控制遮罩的显隐
  @State maskOpacity: number = 0 // 透明度
  @State maskIndex: number = -1; // 显示层级
  // 控制遮罩层图片的缩放
  @State maskImgScaleX: number = 0 // 水平缩放比
  @State maskImgScaleY: number = 0 // 垂直缩放比
  // 获取遮罩层选择的图片Index
  @State maskImgIndex: number = 0

  build() {
    Stack() {
      // 抽卡层
      Column() {
        Grid() {
          ForEach(this.images, (item: ImageCount) => {
            GridItem() {
              Badge({
                count: item.count,
                position: BadgePosition.RightTop,
                style: {
                  fontSize: 12,
                  badgeSize: 16
                }
              }) {
                Image(item.url)
                  .width(80)
              }
            }
          })
        }
        .rowsTemplate('1fr 1fr')
        .columnsTemplate('1fr 1fr 1fr')
        .height(300)
        .margin({ top: 50, bottom: 50 })

        // .backgroundColor(Color.Pink)

        Button('立即抽卡')
          .width(200)
          .backgroundColor('#ED5B8C')
          .onClick(() => {
            // 点击时,修改遮罩参数,让遮罩显示
            this.maskOpacity = 1
            this.maskIndex = 99
            // 点击时修改遮罩层图片的缩放比
            this.maskImgScaleX = 1
            this.maskImgScaleY = 1
            //   // 随机获取图片的Index
            this.maskImgIndex = Math.floor(Math.random() * 6)
          })
      }

      // 遮罩层
      Column({ space: 30 }) {
        Text('获得生肖卡')
          .fontColor('#F3EAD3')
          .fontWeight(700)
          .fontSize(24)

        Image(`/images/img_0${this.maskImgIndex}.png`)
          .width(200)
          .scale({
            //控制图片的缩放
            x: this.maskImgScaleX,
            y: this.maskImgScaleY
          })
          .animation({
            // 动画
            duration: 500
          })

        Button('开心收下')
          .width(200)
          .border({
            width: 2,
            color: '#9F9C90',
          })
          .backgroundColor(Color.Transparent)
          .onClick(() => {
            // 点击时,修改遮罩参数,让遮罩隐藏
            this.maskOpacity = 0
            this.maskIndex = -1
            //   // 点击时修改遮罩层图片的缩放比为1:1
            this.maskImgScaleX = 0
            this.maskImgScaleY = 0
          //   开心收下
            this.images[this.maskImgIndex] = {
              url: `/images/img_0${this.maskImgIndex}.png`,
              count: this.images[this.maskImgIndex].count + 1
            }
          })
      }
      .zIndex(this.maskIndex)
      .opacity(this.maskOpacity)
      .backgroundColor('#cc000000')
      .width('100%')
      .height('100%')
      .justifyContent(FlexAlign.Center)

      // 抽大奖遮罩层
      Column({space: 30}) {
        Text('恭喜获得手机一部')
          .fontColor('#E4DDC7')
          .fontWeight(700)
          .fontSize(25)
        Image('/images/hw.png')
          .width(300)
        Button('再来一次')
          .width(200)
          .height(50)
          .border({
            width: 2,
            color: '#E4DDC7'
          })
          .backgroundColor(Color.Transparent)
      }
      .justifyContent(FlexAlign.Center)
      .width('100%')
      .height('100%')
      .backgroundColor('#cc000000')

    }
  }
}

抽大奖遮罩层的显隐

前提:

六张卡片集齐,显示 --- 中大奖页面

默认为 false,不显示此抽大奖遮罩层

判断数组项的count, 是否都大于0, 只能有一个等于0,就意味着没及其

最终效果演示

随机奖品 & 再来一次

奖品随机抽 -》准备一个奖品数组, Math

再来一次 -》重置数据

奖品随机抽

准备奖品数组,默认抽中的奖品为空

准备随机数

在“”开心收下“”按钮下,判断是否中奖,如果中奖了,准备抽奖。

效果:

再来一次

将数据重置

效果演示:

完整代码:

import { trustedAppService } from '@kit.DeviceSecurityKit';

// 定义图片接口
interface ImageCount {
  url: ResourceStr,
  count: number
}

@Entry
  @Component
  struct Index {
    // 定义图片渲染数组
    @State images: ImageCount[] = [
      { url: '/images/bg_00.png', count: 0 },
      { url: '/images/bg_01.png', count: 0 },
      { url: '/images/bg_02.png', count: 0 },
      { url: '/images/bg_03.png', count: 0 },
      { url: '/images/bg_04.png', count: 0 },
      { url: '/images/bg_05.png', count: 0 },
    ]
    // 奖品池
    @State prizePool: string[] = [
      '/images/pg.png',
      '/images/hw.png',
      '/images/xm.png'
    ]
    //抽中的奖品
    @State prize: string = '' // 默认没中奖
    // 控制遮罩的显隐
    @State maskOpacity: number = 0 // 透明度
    @State maskIndex: number = -1; // 显示层级
    // 控制遮罩层图片的缩放
    @State maskImgScaleX: number = 0 // 水平缩放比
    @State maskImgScaleY: number = 0 // 垂直缩放比
    // 获取遮罩层选择的图片Index
    @State maskImgIndex: number = 0
    // 控制中大奖的显隐
    @State isGet: boolean = false // 中大奖显隐

    build() {
      Stack() {
        // 抽卡层
        Column() {
          Grid() {
            ForEach(this.images, (item: ImageCount) => {
              GridItem() {
                Badge({
                  count: item.count,
                  position: BadgePosition.RightTop,
                  style: {
                    fontSize: 12,
                    badgeSize: 16
                  }
                }) {
                  Image(item.url)
                    .width(80)
                }
              }
            })
          }
          .rowsTemplate('1fr 1fr')
            .columnsTemplate('1fr 1fr 1fr')
            .height(300)
            .margin({ top: 50, bottom: 50 })

          // .backgroundColor(Color.Pink)

          Button('立即抽卡')
            .width(200)
            .backgroundColor('#ED5B8C')
            .onClick(() => {
              // 点击时,修改遮罩参数,让遮罩显示
              this.maskOpacity = 1
              this.maskIndex = 99
              // 点击时修改遮罩层图片的缩放比
              this.maskImgScaleX = 1
              this.maskImgScaleY = 1
              //   // 随机获取图片的Index
              this.maskImgIndex = Math.floor(Math.random() * 6)
            })
        }

        // 遮罩层
        Column({ space: 30 }) {
          Text('获得生肖卡')
            .fontColor('#F3EAD3')
            .fontWeight(700)
            .fontSize(24)

          Image(`/images/img_0${this.maskImgIndex}.png`)
            .width(200)
            .scale({
              //控制图片的缩放
              x: this.maskImgScaleX,
              y: this.maskImgScaleY
            })
            .animation({
              // 动画
              duration: 500
            })

          Button('开心收下')
            .width(200)
            .border({
              width: 2,
              color: '#9F9C90',
            })
            .backgroundColor(Color.Transparent)
            .onClick(() => {
              // 点击时,修改遮罩参数,让遮罩隐藏
              this.maskOpacity = 0
              this.maskIndex = -1
              //   // 点击时修改遮罩层图片的缩放比为1:1
              this.maskImgScaleX = 0
              this.maskImgScaleY = 0
              //   开心收下
              this.images[this.maskImgIndex] = {
                url: `/images/img_0${this.maskImgIndex}.png`,
              count: this.images[this.maskImgIndex].count + 1
            }
            // 每次收完,要进行简单检索,判断是否集齐
            // 需求:判断数组项的count, 是否都大于0, 只能有一个等于0,就意味着没及其
            let flag: boolean = true // 假设集齐
            // 验证是否集齐
            for (let item of this.images) {
              if (item.count === 0) {
                flag = false // 没集齐
                break; // 只要没集齐,便可退出循环
              }
            }
            this.isGet = flag
            if (flag) {
              let randIndex: number = Math.floor(Math.random() * 3)
              this.prize = this.prizePool[randIndex]
            }
          })
      }
      .zIndex(this.maskIndex)
      .opacity(this.maskOpacity)
      .backgroundColor('#cc000000')
      .width('100%')
      .height('100%')
      .justifyContent(FlexAlign.Center)

      // 抽大奖遮罩层
      if (this.isGet) {
        Column({ space: 30 }) {
          Text('恭喜获得手机一部')
            .fontColor('#E4DDC7')
            .fontWeight(700)
            .fontSize(25)
          Image(this.prize)
            .width(300)
          Button('再来一次')
            .width(200)
            .height(50)
            .border({
              width: 2,
              color: '#E4DDC7'
            })
            .backgroundColor(Color.Transparent)
            .onClick(() => {
              this.isGet = false
              this.prize = ''
              this.images = [
                { url: '/images/bg_00.png', count: 0 },
                { url: '/images/bg_01.png', count: 0 },
                { url: '/images/bg_02.png', count: 0 },
                { url: '/images/bg_03.png', count: 0 },
                { url: '/images/bg_04.png', count: 0 },
                { url: '/images/bg_05.png', count: 0 },
              ]
            })
        }
        .justifyContent(FlexAlign.Center)
        .width('100%')
        .height('100%')
        .backgroundColor('#cc000000')
      }
    }
  }
}

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

宿舍管理系统(servlet+jsp)

宿舍管理系统(servletjsp) 宿舍管理系统是一个用于管理学生宿舍信息的平台,支持超级管理员、教师端和学生端三种用户角色登录。系统功能包括宿舍管理员管理、学生管理、宿舍楼管理、缺勤记录、添加宿舍房间、心理咨询留言板、修改密码和退出系统等模块。宿舍管理员…

驱动-兼容不同设备-container_of

驱动兼容不同类型设备 在 Linux 驱动开发中,container_of 宏常被用来实现一个驱动兼容多种不同设备的架构。这种设计模式在 Linux 内核中非常常见,特别 是在设备驱动模型中。linux内核的主要开发语言是C,但是现在内核的框架使用了非常多的面向…

MySQLQ_数据库约束

目录 什么是数据库约束约束类型NOT NULL 非空约束UNIQUE 唯一约束PRIMARY KEY主键约束FOREIGN KEY外键约束CHECK约束DEFAULT 默认值(缺省)约束 什么是数据库约束 数据库约束就是对数据库添加一些规则,使数据更准确,关联性更强 比如加了唯一值约束&#…

责任链设计模式(单例+多例)

目录 1. 单例责任链 2. 多例责任链 核心区别对比 实际应用场景 单例实现 多例实现 初始化 初始化责任链 执行测试方法 欢迎关注我的博客!26届java选手,一起加油💘💦👨‍🎓😄😂 最近在…

林纳斯·托瓦兹:Linux系统之父 Git创始人

名人说:路漫漫其修远兮,吾将上下而求索。—— 屈原《离骚》 创作者:Code_流苏(CSDN)(一个喜欢古诗词和编程的Coder😊) 林纳斯托瓦兹:Linux之父、Git创始人 一、传奇人物的诞生 1. 早年生活与家…

8. RabbitMQ 消息队列 + 结合配合 Spring Boot 框架实现 “发布确认” 的功能

8. RabbitMQ 消息队列 结合配合 Spring Boot 框架实现 “发布确认” 的功能 文章目录 8. RabbitMQ 消息队列 结合配合 Spring Boot 框架实现 “发布确认” 的功能1. RabbitMQ 消息队列 结合配合 Spring Boot 框架实现 “发布确认” 的功能1.1 回退消息 2.备用交换机3. API说…

维港首秀!沃飞长空AE200亮相香港特别行政区

4月13日-16日,第三届香港国际创科展在香港会议展览中心盛大举办。 作为国内领先、国际一流的eVTOL主机厂,沃飞长空携旗下AE200批产构型登陆国际舞台,以前瞻性的创新技术与商业化应用潜力,吸引了来自全球17个国家及地区的行业领袖…

redis6.2.6-prometheus监控

一、软件及系统信息 redis:redis-6.2.6 redis_exporter:redis_exporter-v1.50.0.linux-amd64.tar.gz # cat /etc/anolis-release Anolis OS release 8.9 granfa; 7.5.3 二、下载地址 https://github.com/oliver006/redis_exporter/releases?page…

如何在idea中快速搭建一个Spring Boot项目?

文章目录 前言1、创建项目名称2、勾选需要的依赖3、在setting中检查maven4、编写数据源5、开启热启动(热部署)结语 前言 Spring Boot 凭借其便捷的开发特性,极大提升了开发效率,为 Java 开发工作带来诸多便利。许多大伙伴希望快速…

itext7 html2pdf 将html文本转为pdf

1、将html转为pdf需求分析 经常会看到爬虫有这样的需求,将某一个网站上的数据,获取到了以后,进行分析,然后将需要的数据进行存储,也有将html转为pdf进行存储,作为原始存档,当然这里看具体的需求…

docker compose搭建博客wordpress

一、前言 docker安装等入门知识见我之前的这篇文章 https://blog.csdn.net/m0_73118788/article/details/146986119?fromshareblogdetail&sharetypeblogdetail&sharerId146986119&sharereferPC&sharesourcem0_73118788&sharefromfrom_link 1.1 docker co…

代码随想录算法训练营Day30

力扣452.用最少数量的箭引爆气球【medium】 力扣435.无重叠区间【medium】 力扣763.划分字母区间【medium】 力扣56.合并区间【medium】 一、力扣452.用最少数量的箭引爆气球【medium】 题目链接:力扣452.用最少数量的箭引爆气球 视频链接:代码随想录 题…

无感改造,完美监控:Docker 多阶段构建 Go 应用无侵入观测

作者:牧思 背景 随着云原生的普及,Golang 编程语言变得越来越热门。相比 Java,Golang 凭借其轻量,易学习的特点得到了越来越多工程师的青睐,然而由于 Golang 应用需要被编译成二进制文件再进行运行,Golan…

006.Gitlab CICD流水线触发

文章目录 触发方式介绍触发方式类型 触发方式实践分支名触发MR触发tag触发手动人为触发定时任务触发指定文件变更触发结合分支及文件变更触发正则语法触发 触发方式介绍 触发方式类型 Gitlab CICD流水线的触发方式非常灵活,常见的有如下几类触发方式: …

512天,倔强生长:一位技术创作者的独白

亲爱的读者与同行者: 我是倔强的石头_,今天是我在CSDN成为创作者的第512天。当系统提示我写下这篇纪念日文章时,我恍惚间想起了2023年11月19日的那个夜晚——指尖敲下《开端——》的标题,忐忑又坚定地按下了“发布”键。那时的我…

【目标检测】【YOLO综述】YOLOv1到YOLOv10:最快速、最精准的实时目标检测系统

YOLOv1 to YOLOv10: The fastest and most accurate real-time object detection systems YOLOv1到YOLOv10:最快速、最精准的实时目标检测系统 论文链接 0.论文摘要 摘要——本文是对YOLO系列系统的全面综述。与以往文献调查不同,本综述文…

日常学习开发记录-slider组件

日常学习开发记录-slider组件 从零开始实现一个优雅的Slider滑块组件前言一、基础实现1. 组件结构设计2. 基础样式实现3. 基础交互实现 二、功能增强1. 添加拖动功能2. 支持范围选择3. 添加垂直模式 三、高级特性1. 键盘操作支持2. 禁用状态 五、使用示例六、总结 从零开始实现…

Windows 系统如何使用Redis 服务

前言 在学习过程中,我们长期接触到的是Mysql 关系型数据库,也是够我们平时练习项目用的,但是后面肯定会有大型数据的访问就要借助新的新的工具。 一、什么是Redis Redis(Remote Dictionary Server)是一个基于内存的 键…

【unity游戏开发入门到精通——UGUI】CanvasScaler画布缩放器组件

注意:考虑到UGUI的内容比较多,我将UGUI的内容分开,并全部整合放在【unity游戏开发——UGUI】专栏里,感兴趣的小伙伴可以前往逐一查看学习。 文章目录 一、CanvasScaler画布缩放器组件是什么二、CanvasScaler的三种适配模式1、Cons…

Hugging Face 模型:AI 模型的“拥抱”与开源革命!!!

🌐 Hugging Face 模型:AI 模型的“拥抱”与开源革命 用表情符号、图表和代码,探索开源模型生态的底层逻辑与应用场景! 🌟 名字由来:为什么叫 Hugging Face? “Hugging”:象征 开放…