vue3实现自定义select下拉框内容之城市区域篇

news2024/9/30 7:33:37

分享-2023年高级前端进阶:前端登顶之巅-最全面的前端知识点总结站点

*分享一个使用比较久的🪜

需求分析:
1、实现一个区域下拉选项与现有ui组件库不同,支持多选、单选需求
2、支持选中区域后-全选中当前区域下的所有城市信息
3、只能选中当前一个区域的内的城市其余城市禁用

扩展思路:
1、封装公共组件或者封装在组件库内
2、出入参相关api透明好理解
3、支持单选或者多选,支持只选择当前区域下的城市或者全面区域下的城市
4、在原有的element plus下进行扩展延伸满足需求
5、缺陷:未做maxLength-标签最大展示的api;这个按需自己修改一下就行

1、第一种模式:显示区域信息
在这里插入图片描述
2、第二种模式:只展示城市内容
在这里插入图片描述

1、相关开发代码篇

创建文件:custom-select.vue文件;复制copy当下代码;
使用方式:
1、外部入参例如城市:dataSource=[{ label: 华北,value: '华东', children: [{ label: '山东',value: 'shandong'}]],树形结构
2、标签引用:<custom-select :disabled="true" :multilevel="true" height="32" v-model="checkGroup" :dataSource="cityList"></custom-select>
3、相关api说明文档在文章底部

<template>
  <div
    tabindex="1"
    ref="customSelectRef"
    @click="handleClickDiv"
    @mouseenter="handelMouseEnter"
    @mouseleave="handleMouseLeave"
    :style="{ width: modelLabel && modelValue?.length ? '166px' : '100px', height: (height + 'px') || '25px' }"
    :class="['custom-select_contaniner-i', isShowDropdown && 'custom-select_background']"
  >
    <div>
      <span v-if="modelLabel" class="custom-tag">
        <span>{{ modelLabel }}</span>
        <i
          class="custom_tag_delete"
          @mouseenter="handelIconMouseEnter"
          @mouseleave="handleIconMouseLeave"
          @click.stop="handleDeleteIcon"
        >
          <svg
            v-if="!ishShowIconDeleteText"
            t="1678090923023"
            class="icon"
            viewBox="0 0 1024 1024"
            version="1.1"
            xmlns="http://www.w3.org/2000/svg"
            p-id="6709"
            width="11"
            height="11"
          >
            <path
              d="M263.802377 224.219482a7.964444 7.964444 0 0 1 11.263425 0l236.934198 236.934198 236.934198-236.934198a7.964444 7.964444 0 0 1 11.263425 0l39.582895 39.582895a7.964444 7.964444 0 0 1 0 11.263425l-236.934198 236.934198 236.934198 236.934198a7.964444 7.964444 0 0 1 0 11.263425l-39.582895 39.582895a7.964444 7.964444 0 0 1-11.263425 0l-236.934198-236.934198-236.934198 236.934198a7.964444 7.964444 0 0 1-11.263425 0l-39.582895-39.582895a7.964444 7.964444 0 0 1 0-11.263425l236.934198-236.934198-236.934198-236.934198a7.964444 7.964444 0 0 1 0-11.263425l39.582895-39.582895z"
              fill="#8a8a8a"
              p-id="6710"
            />
          </svg>
          <svg
            v-else
            t="1678091410677"
            class="icon"
            viewBox="0 0 1024 1024"
            version="1.1"
            xmlns="http://www.w3.org/2000/svg"
            p-id="6936"
            width="22"
            height="22"
          >
            <path
              d="M479.072 512l-98.72-98.72c-9.152-9.152-9.088-23.84 0-32.928 9.152-9.152 23.84-9.088 32.928 0l98.72 98.72 98.72-98.72c9.152-9.152 23.84-9.088 32.928 0 9.152 9.152 9.088 23.84 0 32.928l-98.72 98.72 98.72 98.72c9.152 9.152 9.088 23.84 0 32.928-9.152 9.152-23.84 9.088-32.928 0l-98.72-98.72-98.72 98.72c-9.152 9.152-23.84 9.088-32.928 0-9.152-9.152-9.088-23.84 0-32.928l98.72-98.72zM512 837.824c179.936 0 325.824-145.888 325.824-325.824s-145.888-325.824-325.824-325.824c-179.936 0-325.824 145.888-325.824 325.824s145.888 325.824 325.824 325.824z"
              fill="#B7B8B9"
              p-id="6937"
            />
          </svg>
        </i>
      </span>
      <span v-if="modelLabel && modelValue?.length > 1" class="custom-tag">+ {{ modelValue.length - 1 }}</span>
      <span v-if="!modelLabel" class="cus_placeholder">{{ placeholder }}</span>
    </div>
    <i class="arrow-top-icon" v-if="!isShowIconRemove || !modelLabel" :class="[!isShowDropdown && 'arrow-top-icon-active']">
      <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
        <path
          fill="currentColor"
          d="M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"
        />
      </svg>
    </i>
    <i class="remove-icon" v-if="isShowIconRemove && modelLabel" @click.stop="handleRemove">
      <svg
        t="1678084213981"
        class="icon"
        viewBox="0 0 1024 1024"
        version="1.1"
        xmlns="http://www.w3.org/2000/svg"
        p-id="4480"
        width="11"
        height="11"
      >
        <path
          d="M512 32c265.097 0 480 214.903 480 480S777.097 992 512 992 32 777.097 32 512 246.903 32 512 32z m0 64C282.25 96 96 282.25 96 512s186.25 416 416 416 416-186.25 416-416S741.75 96 512 96z m169.706 246.294c12.496 12.497 12.496 32.758 0 45.255L557.256 512l124.45 124.452c12.496 12.497 12.496 32.758 0 45.255-12.497 12.496-32.758 12.496-45.255 0L512 557.254 387.549 681.706c-12.497 12.496-32.758 12.496-45.255 0-12.496-12.497-12.496-32.758 0-45.255l124.452-124.452-124.452-124.45c-12.496-12.497-12.496-32.758 0-45.255 12.497-12.496 32.758-12.496 45.255 0l124.452 124.45 124.45-124.45c12.497-12.496 32.758-12.496 45.255 0z"
          fill="#8a8a8a"
          p-id="4481"
        />
      </svg>
    </i>
  </div>
  <transition>
    <div
      v-if="isShowDropdown"
      ref="cusSelectDropdown"
      class="cus_select_background"
      :style="{ minWidth: popperOffestWidth + 'px', zIndex: 99999 }"
    >
      <div v-if="multilevel" style="padding: 5px 20px;">
        <div :key="key" v-for="(opt, key) in cusDataListChecked" class="multilevel_box">
          <el-checkbox
            style="width: 60px;"
            v-model="opt.checkAll"
            @change="handleCheckAllChange($event, opt)"
            :indeterminate="opt.isIndeterminate"
            :disabled="disabled && checkList.length ? !opt.checkList.length : false"
            >
            {{ opt.label }}
          </el-checkbox>
          <el-checkbox-group 
            v-model="opt.checkList"
            v-if="opt.children"
            @change="handleCheckedCitiesChange($event, opt)"
            style="display: inline-block; padding-left: 20px" 
          >
              <el-checkbox 
                :label="item.value" 
                style="width: 60px"
                :key="index + Math.random()" 
                v-for="(item, index) in opt.children" 
                :disabled="disabled && checkList.length ? !opt.checkList.length : false"
                >
                {{ item.label }}
              </el-checkbox>
          </el-checkbox-group>
        </div>
      </div>
      <div class="cus_select_contaniner" v-else>
        <div class="cus_select_left">中国</div>
        <div class="cus_select_right">
          <el-checkbox-group 
            v-model="checkList" 
            @change="handelCheckGroup"
            style="display: inline-block; padding-left: 20px" 
          >
            <el-checkbox 
              :key="index" 
              :label="item.value" 
              style="width: 60px"
              v-for="(item, index) in dataSource" 
            >
              {{ item.label }}
            </el-checkbox>
          </el-checkbox-group>
        </div>
      </div>
      <span class="el-popper__arrow" data-popper-arrow="" style="position: absolute; left: 140px;"></span>
    </div>
  </transition>
</template>
<script setup lang="ts">
import { createPopper } from '@popperjs/core'
import { ref, onMounted, nextTick, watch, onUnmounted, toRaw, onBeforeMount, computed } from 'vue'

const props = withDefaults(
  defineProps<{
    height?: string | number
    dataSource: any
    modelValue?: any
    placeholder?: string
    multilevel?: boolean
    disabled?: boolean
  }>(),
  {
    height: 25,
    disabled: false,
    multilevel: false,
    dataSource: [],
    modelValue: [],
    placeholder: '请选择'
  }
)

const emit = defineEmits(['update:modelValue'])

const customSelectRef = ref()

const cusSelectDropdown = ref()

const cusDataListChecked = ref<any[]>([])

const checkList = ref<string[]>([])

const popperOffestWidth = ref<number>(0)

const isShowDropdown = ref<boolean>(false)

const modelLabel = ref<string>('')

const isShowIconRemove = ref<boolean>(false)

const ishShowIconDeleteText = ref<boolean>(false)

const handleClickDiv = () => {
  isShowDropdown.value = !isShowDropdown.value
}

const handelCheckGroup = (value) => {
  const obj = props.dataSource.filter((item) => item.value === value[0])[0]
  modelLabel.value = obj?.label
  emit('update:modelValue', value)
}

const handelMouseEnter = () => {
  isShowIconRemove.value = true
}

const handleMouseLeave = () => {
  isShowIconRemove.value = false
}

const handleRemove = () => {
  modelLabel.value = ''
  checkList.value = []
  if (isShowDropdown.value) {
    isShowDropdown.value = false
  }
  if (props.multilevel) {
    cusDataListChecked.value = addCheckProperties(props.dataSource)
  }
  emit('update:modelValue', [])
}

const handleDeleteIcon = () => {
  isShowDropdown.value = false
  checkList.value.splice(0, 1)
  if (props.multilevel) return cusDataListChecked.value = findTreeChecked(cusDataListChecked.value)
  const info = toRaw(checkList.value)[0]
  const obj = props.dataSource.filter((item) => item.value === info)[0]
  modelLabel.value = obj?.label || ''
}

const handelIconMouseEnter = () => {
  ishShowIconDeleteText.value = true
}

const handleIconMouseLeave = () => {
  ishShowIconDeleteText.value = false
}

// 点击某个DOM元素之外的方法
const handlerDocClick = (event) => {
  const isSelf = customSelectRef.value?.contains(event.target) 
  || cusSelectDropdown.value?.contains(event.target)
  if (!isSelf) {
    isShowDropdown.value = false
  }
}

/**
 * 展示区域省份的逻辑
 * */ 
const handleCheckAllChange = (bool: any, option) => {
  const allCity = option.children ? option.children.map(item => item.value) : [option.value]
  bool ? option.checkList = allCity : option.checkList = []
  option.isIndeterminate = false
  checkList.value = option.checkList
  const newLabelArr = option.children 
  ? option.children.filter(item => checkList.value.includes(item.value)) 
  : checkList.value?.length ? [{ label: '默认' }] : []
  modelLabel.value = newLabelArr?.[0]?.label || ''
  emit('update:modelValue', checkList.value)
}

const handleCheckedCitiesChange = (value: any[], option) => {
  const checkedCount = value.length
  const allCity = option.children ? option.children.map(item => item.value) : [option.value]
  option.checkAll = checkedCount === allCity.length
  option.isIndeterminate = checkedCount > 0 && checkedCount < allCity.length
  checkList.value = option.checkList
  const newLabelArr = option.children 
  ? option.children.filter(item => checkList.value.includes(item.value)) 
  : checkList.value?.length ? [{ label: '默认' }] : []
  modelLabel.value = newLabelArr?.[0]?.label || ''
  emit('update:modelValue', checkList.value)
}

const addCheckProperties = (treeData) => {
  let result = []
  result = JSON.parse(JSON.stringify(treeData))
  result.forEach(node => {
    const child = node.children;
    node.checkAll = false;
    node.isIndeterminate = false;
    node.checkList = [];
    if (child && child.length > 0) {
      addCheckProperties(child);
    }
  });
  return result
}

const findTreeChecked = (treeData) => {
  let newLabel
  const val = toRaw(checkList.value)
  const defaultBool = val.some(item => item.includes('default'))
  treeData.forEach(node => {
    if (node.children?.length) {
      const child = node.children;
      const bool = child.some(opt => val.includes(opt.value))
      !newLabel ? newLabel = child.filter(item => val.includes(item.value))[0] : void null
      if (bool) {
        node.checkAll = val.length === child?.length;
        node.isIndeterminate = val.length > 0 && val.length < child?.length;
        node.checkList = val;
      } else {
        node.isIndeterminate = false
      }
    }
  })
  treeData[0].isIndeterminate = false;
  treeData[0].checkAll = defaultBool ? true : false;
  treeData[0].checkList = defaultBool ? ['default'] : [];
  modelLabel.value = defaultBool ? '默认' : newLabel?.label || ''
  return treeData
}

watch(
  [customSelectRef, cusSelectDropdown],
  () => {
    if (customSelectRef.value && cusSelectDropdown.value) {
      createPopper(customSelectRef.value, cusSelectDropdown.value, {
        placement: 'bottom',
        modifiers: [
          {
            name: 'offset',
            options: {
              offset: [80, 8]
            }
          }
        ]
      })
    }
  },
  {
    deep: true,
    immediate: true
  }
)

watch(
  props.modelValue,
  (newval) => {
    if (!newval || !newval.length) return
    checkList.value = props.modelValue
    if (props.multilevel) return
    const obj = props.dataSource.filter((item) => item.value === newval[0])[0]
    modelLabel.value = obj?.label
  },
  {
    deep: true,
    immediate: true
  }
)

onBeforeMount(() => {
  if (props.multilevel) {
    cusDataListChecked.value = addCheckProperties(props.dataSource)
  }
})

onMounted(async () => {
  await nextTick()
  popperOffestWidth.value = customSelectRef.value.offsetWidth
  document.addEventListener('click', handlerDocClick, true)
  if (props.multilevel && props.modelValue.length) { 
    cusDataListChecked.value = findTreeChecked(cusDataListChecked.value)
  }
})

onUnmounted(() => {
  document.removeEventListener('click', handlerDocClick, true)
})
</script>

<script lang="ts">
export default { name: 'CustomSelect' }
</script>

<style lang="scss" scoped>
.v-enter-active,
.v-leave-active {
  transition: opacity 0.5s ease;
}

.v-enter-from,
.v-leave-to {
  opacity: 0;
}

.custom-select_contaniner-i {
  width: 100%;
  height: 25px;
  padding: 7px 9px;
  padding-left: 5px;
  border-radius: 4px;
  line-height: 1;
  cursor: pointer;
  position: relative;
  user-select: none;
  word-wrap: break-word;
  word-break: break-all;
  font-size: 13px;
  flex-grow: 1;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  justify-content: space-between;
  color: var(--el-input-text-color, var(--el-text-color-regular));
  background-color: var(--el-input-bg-color, var(--el-fill-color-blank));
  box-shadow: 0 0 0 1px var(--el-input-border-color, var(--el-border-color)) inset;
}

.custom-tag {
  color: var(--el-color-info);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  height: 18px;
  padding: 0 9px;
  line-height: 1;
  border-radius: 4px;
  white-space: nowrap;
  font-size: 12px;
  background-color: var(--el-fill-color);
}

.custom_tag_delete {
  width: 18px;
  margin-left: 5px;
  font-size: 0px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  color: var(--el-color-info);
}

.custom-tag:first-child {
  margin-right: 6px;
  padding-right: 4px;
}

.arrow-top-icon {
  width: 14px;
  transform: rotateX(-180deg);
  color: var(--el-text-color-placeholder);
}

.remove-icon {
  margin-top: 2px;
  color: var(--el-text-color-placeholder);
}

.arrow-top-icon-active {
  transform: rotateX(0deg);
}

.custom-select:hover {
  box-shadow: 0 0 0 1px var(--el-border-color-hover) inset;
}

.custom-select:focus {
  outline: none;
  box-shadow: 0 0 0 1px var(--el-color-primary) inset;
}

.custom-select_background {
  box-shadow: 0 0 0 1px var(--el-color-primary) inset;
}

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
  background-color: transparent;
}

/*滚动条的轨道*/
::-webkit-scrollbar-track {
  background-color: transparent;
}

/*滚动条的滑块按钮*/
::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background-color: rgba(0, 0, 0, 0.1);
  box-shadow: inset 0 0 2px rgba(#000000, 0.04);
}

/*滚动条的上下两端的按钮*/
::-webkit-scrollbar-button {
  height: 0;
  background-color: transparent;
}

.cus_select_contaniner {
  padding: 5px 10px;
  display: flex;
}

.cus_select_left {
  width: 60px;
  margin-top: 5px;
}

.cus_select_right {
  flex: 1;
  width: 480px;
}

.cus_select_background {
  min-height: 200px;
  box-sizing: border-box;
  border-radius: 4px;
  font-size: var(--el-font-size-base);
  color: var(--el-text-color-regular);
  background: var(--el-bg-color-overlay);
  border: 1px solid var(--el-border-color-light);
  .multilevel_box {
    display: flex; 
    padding: 5px; 
    border-bottom: 1px solid #e4e7ed;
  }
  .multilevel_box:last-child {
    border-bottom: none;
  }
}

.cus_placeholder {
  color: var(--el-text-color-placeholder);
}

.el-popper__arrow {
  top: -5px;
}

.el-popper__arrow {
  position: absolute;
  width: 10px;
  height: 10px;
  z-index: -1;
}

.el-popper__arrow::before {
  border: 1px solid var(--el-border-color-light);
  background: var(--el-bg-color-overlay);
  right: 0;
  border-bottom-color: transparent!important;
  border-right-color: transparent!important;
}
</style>
2、组件-相关api说明
参数说明类型默认值必填项
height输入框的高度String/Number25
dataSource[{}]-label,value;树形结构Array[][]
modelValue当前选中项内容Array[]
placeholder输入框内容String请输入
multilevel是否开启跨层级模式Booleanfalse
disabled是否开启跨层级禁用Booleanfalse

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

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

相关文章

CommonCollections3链分析

先介绍一下URLClassLoader URLClassLoader可以从传入的URL上加载任意类 且支持http协议 实际上类加载最关键的地方在Classloader#definClass() 所以我们要去找有谁调用了该方法 在TemplatesImpl的内部类TransletClassLoader#defineClass()处调用 往前 TemplatesImpl#defin…

OpenCV 中的光流 (C++/Python)

什么是光流? 光流是一项视频中两个连续帧之间每像素运动估计的任务。基本上,光流任务意味着计算像素的位移矢量作为两个相邻图像之间的对象位移差。光流的主要思想是估计物体由其运动或相机运动引起的位移矢量。 理论基础 假设我们有一个灰度图像——具有像素强度的矩阵。我…

【YOLOX】《YOLOX:Exceeding YOLO Series in 2021》

arXiv-2021 文章目录 1 Background and Motivation2 Related Work3 Advantages / Contributions4 Method5 Experiments5.1 Datasets and Metrics 6 Conclusion&#xff08;own&#xff09; 1 Background and Motivation 2 Related Work 3 Advantages / Contributions 4 Meth…

自定义注解(Annontation)

目录 1.注解定义 2.元注解定义 3. 自定义注解&#xff08;自定义的注解名称相同的会覆盖原注解&#xff09; 4.Annotation架构&#xff08;元注解参数介绍&#xff09; 1.注解定义 注解是用来将任何的信息或元数据&#xff08;metadata&#xff09;与程序元素&#xff08;类…

行业报告 | Q3策略汇报:持续看好AI+复苏、国产化

原创 | 文 BFT机器人 01 国产化是产业发展基石 1.1 设备&#xff1a;量测等环节国产化弹性大 刻蚀、清洗、CMP等环节国产化率较高。得益于北方华创、中微公司的产品突破和市占率提升&#xff0c;刻蚀环节国产化率在2022年已接近20%&#xff0c;鉴于刻蚀设备市场空间广阔&#…

电影订票选座商城开发--源码部署,快速搭建

一、技术选择 电影订票选座商城开发需要结合前端和后端技术来实现。 二、功能设计 电影订票选座商城需要具备以下功能&#xff1a; 用户注册登录&#xff1a;用户可以通过手机号、邮箱等方式注册账号&#xff0c;并通过登录验证获取权限。 电影票查询&#xff1a;用户可以查…

喆啡酒店十周年丨啡越时间限,ALL BY 10VE!

啡越时光热爱为伴 十年前&#xff0c;秉持对咖啡馆文化及复古风格的喜爱&#xff0c;喆啡酒店创造全新的Coffetel品类&#xff0c;将充满「温暖」「愉悦」「咖啡香」的格调体验带给消费者&#xff0c;成为无数人「旅途中的啡凡存在」。 十年间&#xff0c;喆啡酒店以热爱化为…

在Hierarchy层级面板上组织业务脚本流程——使用async和await

〇、把多个不同的脚本串联在一起顺序阻塞执行 把很多个脚本串联在一起&#xff0c;让他们按照先后顺序执行&#xff0c;等着前面的执行完毕&#xff0c;在执行后面的&#xff0c;这就是用【异步方法】实现的&#xff0c;能够顺序执行的流程。 如下图所示&#xff0c;流程脚本都…

CleanMyMac2023永久版Mac清理工具

CleanMyMac拥有超强的清理能力&#xff0c;能够快速清理Mac垃圾文件、陈旧数据&#xff0c;恢复Mac原本性能&#xff0c;保持电脑好状态&#xff01;CleanMyMac中文版功能非常的强大&#xff0c;操作简单&#xff0c;使用起来高效快捷&#xff0c;自身拥有一个安全数据&#xf…

安装OpenCV依赖包libjasper-dev无法安装

记录在ubuntu22.04上编译OpenCV4.6&#xff0c;遇到依赖包无法安装的问题。 主要是源的问题 sudo gedit /etc/apt/sources.list我的源文件&#xff0c;######处的下一行是改动的地方&#xff0c;主要把自带的源都注释了&#xff0c;然后在末尾添加了清华源。 # deb cdrom:[Ubu…

详解C语言中的int8_t、uint8_t、int16_t、uint16_t、int32_t、uint32_t、int64_t、uint64_t

2023年8月8日&#xff0c;周二上午 目录 为什么会产生int8_t、uint8_t等这类数据类型int8_t、uint8_t等这类数据类型有什么用头文件int8_t、uint8_t等这类数据类型是怎么实现的 为什么会产生int8_t、uint8_t等这类数据类型 根本原因在于&#xff0c;C 语言标准只是规定了各个…

CentOS8装不上软件

App stream什么提示、或者找不到firewalld服务等类似提示时。可以尝试替换/etc/yum.repos.d文件夹下的文件内容。记得替换之前先备份原有的&#xff0c;防止意外情况便于恢复。 替换后文件如下&#xff1a; 文件下载地址&#xff1a; https://download.csdn.net/download/zhao…

也谈态势感知的嵌套与级联

不同颗粒度的态势感知可以嵌套在一起&#xff0c;形成一个层次结构&#xff0c;从而提供全面和多层次的信息获取和理解。 在态势感知中&#xff0c;颗粒度可以理解为观察、收集和分析信息的细节程度。较高颗粒度的态势感知关注的是具体的事件、行动或细节&#xff0c;提供了详细…

如何高性能、高效率地实现3D Web轻量化?

随着互联网和Web技术的发展&#xff0c;3D Web应用的需求越来越多。然而&#xff0c;复杂的3D模型在Web上展示和交互通常需要大量的带宽和计算资源。为了解决这一问题&#xff0c;HOOPS技术作为一套专业的3D图形技术开发工具包&#xff0c;发挥着关键作用。本文将探讨HOOPS技术…

问道管理:新创业板权限怎么开通?

在我国证券商场中&#xff0c;创业板能够被认为是相对较为年青的板块&#xff0c; 但在近几年中&#xff0c;创业板体现出了极高的投资价值。为了更好地促进我国立异企业开展&#xff0c;政府开放了新创业板权限。可是&#xff0c;对于很多人来说&#xff0c;新创业板权限是一个…

【MySQL学习】道士下山——MySQL的安装教程

学习数据库&#xff0c;不仅仅需要学习数据库的理论知识&#xff0c;还需要掌握一定的数据库开发能力&#xff1b;为后续的数据库应用开发、数据库内核开发等打下良好的基础。 对于学习者而言&#xff0c;目前市面上的Oracle等数据库软件需要付费&#xff0c;而MySQL作为一款免…

又一关键系统上线!海底捞进销存系统登陆OceanBase,数据库整体成本节省50%

2020 年&#xff0c;海底捞全面实现“云上捞”&#xff0c;将所有核心业务系统上云&#xff0c;全面推进企业数字化进程。而随着海底捞业务的不断增长&#xff0c;加上数智化转型构建全新的线上智慧服务&#xff0c;原有 IT 系统架构已经逐渐无法有效“驾驭”海量数据与突发流量…

Java之多线程和并发应用

多线程和并发应用 1. 概念与意义2. 多线程的实际应用场景2.1 网络通信2.2 数据库操作2.3 图片处理 3. 多线程的创建方式3.1 继承 Thread 类3.2 实现 Runnable 类3.3 实现 Callable 接口3.4 比较 Thread 和 Runnable3.5 线程同步与锁3.6 线程池 4. 并发编程的挑战和解决方案4.1 …

mysql存储过程定时调度

假设我们要创建一个简单的数据库&#xff0c;其中包含两张表&#xff1a;students 表和 courses 表&#xff0c;以及一个存储过程用于插入学生数据。下面是完整的建表语句、插入语句和存储过程&#xff1a; 1】建表 -- 创建 courses 表 CREATE TABLE courses (course_id INT …

【自然语言处理】大模型高效微调:PEFT 使用案例

文章目录 一、PEFT介绍二、PEFT 使用2.1 PeftConfig2.2 PeftModel2.3 保存和加载模型 三、PEFT支持任务3.1 Models support matrix3.1.1 Causal Language Modeling3.1.2 Conditional Generation3.1.3 Sequence Classification3.1.4 Token Classification3.1.5 Text-to-Image Ge…