【Element】Vue+Element表单校验详解

Element表单校验

作为一个后端开发,总结一下实际工作中表单校验的场景和用法。
Element官网:https://element.eleme.cn/#/zh-CN/component/form
代码地址:https://gitee.com/kkmy/kw-microservices/tree/master/kw-ui/kwsphere

常用表单校验场景

  • 表单基本校验(长度、非空、数字类型、金额类型)
  • 嵌套对象校验 (字段较多,存在嵌套对象,使用同一个el-form)
  • 字段联动校验 (审核场景,同意则审核意见置为非必输)
  • 自定义校验函数 (金额类型的长度校验,身份满18岁校验)
  • 重置表单、校验指定表单、校验指定字段(element表单常用方法)
  • 动态列表表单(添加多条配置)
  • 文件校验 (element上传组件)
  • 多表单el-form提交校验

场景使用Demo

表单基本校验

在这里插入图片描述

<template><div class="container"><div class="center-container"><el-form :model="userForm" :rules="rules" ref="userForm" label-width="100px"class="demo-userForm"><el-form-item label="姓名" prop="name"><el-input v-model="userForm.name"></el-input></el-form-item><el-form-item label="性别" prop="gender"><el-radio-group v-model="userForm.gender"><el-radio label=""></el-radio><el-radio label=""></el-radio></el-radio-group></el-form-item><!--中国行政区划代码:https://www.mca.gov.cn/n156/n186/c110746/content.html--><el-form-item label="籍贯" prop="nativePlace"><el-select v-model="userForm.nativePlace" placeholder="请选择性别"><el-option value="110000" label="北京市"></el-option><el-option value="120000" label="天津市"></el-option></el-select></el-form-item><el-form-item label="管理员" prop="admin"><el-switch v-model="userForm.admin"></el-switch></el-form-item><el-form-item label="爱好" prop="hobby"><el-checkbox-group v-model="userForm.hobby"><el-checkbox label="骑行" name="hobby"></el-checkbox><el-checkbox label="跑步" name="hobby"></el-checkbox><el-checkbox label="网游" name="hobby"></el-checkbox><el-checkbox label="旅行" name="hobby"></el-checkbox></el-checkbox-group></el-form-item><el-form-item label="个性签名" prop="desc"><el-input type="textarea" v-model="userForm.desc"></el-input></el-form-item><el-form-item><el-button type="primary" @click="submitForm('userForm')">保 存</el-button><el-button @click="resetForm('userForm')">重 置</el-button></el-form-item></el-form></div><el-dialogtitle="提示":visible.sync="centerDialogVisible"width="30%"@close="closeDialog":close-on-click-modal="false":close-on-press-escape="false"center><span><pre>{{userForm}}</pre></span><span slot="footer" class="dialog-footer"><el-button @click="centerDialogVisible = false">取 消</el-button><el-button type="primary" @click="centerDialogVisible = false">确 定</el-button></span></el-dialog></div>
</template><script>
export default {name: "validate-01",data() {return {userForm: {name: '',nativePlace: '',admin: false,hobby: [],gender: '',desc: ''},rules: {name: [{required: true, message: '请输入姓名', trigger: ['blur', 'change']},{min: 2, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur'}],nativePlace: [{required: true, message: '请选择籍贯', trigger: 'blur'}],hobby: [{type: 'array', required: true, message: '请至少选择一个爱好', trigger: 'change'},{type: 'array', min: 2, message: '请至少选择2个爱好', trigger: 'change'},],gender: [{required: true, message: '请选择性别', trigger: 'change'}],desc: [{required: true, message: '请填写个性签名', trigger: 'blur'},{max: 200, message: '个性签名长度不能大于200', trigger: 'blur'},]},centerDialogVisible: false,};},methods: {closeDialog() {this.centerDialogVisible = false;this.$refs.userForm.resetFields();},submitForm(formName) {this.$refs.userForm.validate((valid) => {if (valid) {this.centerDialogVisible = true;} else {console.log('error submit!!');return false;}});},resetForm(formName) {//this.$refs[formName].resetFields();this.$refs.userForm.resetFields();}}
}
</script><style scoped>
.container {display: flex;justify-content: center;align-items: center;height: 100vh; /* 设置父容器的高度为视口高度,使其充满整个屏幕 */
}.center-container {max-width: 600px; /* 设置内部容器的最大宽度,根据需求进行调整 */
}
</style>

嵌套对象校验

在这里插入图片描述
在这里插入图片描述

<template><div class="container"><div class="center-container"><el-form :model="userForm" :rules="rules" ref="userForm" label-width="100px"class="demo-userForm"><span>基本信息:</span><br><el-form-item label="姓名" prop="name"><el-input v-model="userForm.name"></el-input></el-form-item><el-form-item label="性别" prop="gender"><el-radio-group v-model="userForm.gender"><el-radio label=""></el-radio><el-radio label=""></el-radio></el-radio-group></el-form-item><el-form-item label="籍贯" prop="nativePlace"><el-select v-model="userForm.nativePlace" placeholder="请选择性别"><el-option value="110000" label="北京市"></el-option><el-option value="120000" label="天津市"></el-option></el-select></el-form-item><span>联系方式:</span><br><el-form-item label="QQ" prop="contactDetails.qq"><el-input v-model="userForm.contactDetails.qq"></el-input></el-form-item><el-form-item label="微信" prop="contactDetails.wx"><el-input v-model="userForm.contactDetails.wx"></el-input></el-form-item><el-form-item label="手机号" prop="contactDetails.phone"><el-input v-model="userForm.contactDetails.phone"></el-input></el-form-item><el-form-item><el-button type="primary" @click="submitForm('userForm')">保 存</el-button><el-button @click="resetForm('userForm')">重 置</el-button></el-form-item></el-form></div><el-dialogtitle="提示":visible.sync="centerDialogVisible"width="30%"@close="closeDialog":close-on-click-modal="false":close-on-press-escape="false"center><span><pre>{{ userForm }}</pre></span><span slot="footer" class="dialog-footer"><el-button @click="centerDialogVisible = false">取 消</el-button><el-button type="primary" @click="centerDialogVisible = false">确 定</el-button></span></el-dialog></div>
</template><script>
export default {name: "validate-01",data() {return {userForm: {name: '',nativePlace: '',gender: '',contactDetails: {qq: '',wx: '',phone: ''}},rules: {name: [{required: true, message: '请输入姓名', trigger: ['blur', 'change']},{min: 2, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur'}],nativePlace: [{required: true, message: '请选择籍贯', trigger: 'blur'}],gender: [{required: true, message: '请选择籍贯', trigger: 'change'}],'contactDetails.qq': [{required: true, message: '请输入联系方式qq', trigger: ['blur', 'change']},],'contactDetails.wx': [{required: true, message: '请输入联系方式微信', trigger: ['blur', 'change']},],'contactDetails.phone': [{required: true, message: '请输入联系方式手机号', trigger: ['blur', 'change']},],},centerDialogVisible: false,};},methods: {closeDialog() {this.centerDialogVisible = false;this.$refs.userForm.resetFields();},submitForm(formName) {this.$refs.userForm.validate((valid) => {if (valid) {this.centerDialogVisible = true;} else {console.log('error submit!!');return false;}});},resetForm(formName) {//this.$refs[formName].resetFields();this.$refs.userForm.resetFields();}}
}
</script><style scoped>
.container {display: flex;justify-content: center;align-items: center;height: 100vh; /* 设置父容器的高度为视口高度,使其充满整个屏幕 */
}.center-container {max-width: 600px; /* 设置内部容器的最大宽度,根据需求进行调整 */
}
</style>

字段联动校验

在这里插入图片描述

<template><div class="container"><div class="center-container"><el-form :model="userForm" :rules="rules" ref="userForm" label-width="100px"class="demo-userForm"><el-form-item label="审核结果" prop="result"><el-radio-group v-model="userForm.result" @change="clearValidate"><el-radio-button label="1">通过</el-radio-button><el-radio-button label="0">不通过</el-radio-button></el-radio-group></el-form-item><el-form-item label="审核意见" prop="desc":rules="[{required: userForm.result!=1, message: '请填写审核意见', trigger: 'blur'},{max: 200, message: '审核意见长度不能大于200', trigger: 'blur'}]"><el-input type="textarea" v-model="userForm.desc"></el-input></el-form-item><el-form-item><el-button type="primary" @click="submitForm('userForm')">保 存</el-button><el-button @click="resetForm('userForm')">重 置</el-button></el-form-item></el-form></div><el-dialogtitle="提示":visible.sync="centerDialogVisible"width="30%"@close="closeDialog":close-on-click-modal="false":close-on-press-escape="false"center><span><pre>{{ userForm }}</pre></span><span slot="footer" class="dialog-footer"><el-button @click="centerDialogVisible = false">取 消</el-button><el-button type="primary" @click="centerDialogVisible = false">确 定</el-button></span></el-dialog></div>
</template><script>
export default {name: "validate-01",data() {return {userForm: {result: '1',desc: ''},rules: {result: [{required: true, message: '请选择审核结果', trigger: 'change'}],},centerDialogVisible: false,};},methods: {closeDialog() {this.centerDialogVisible = false;this.$refs.userForm.resetFields();},clearValidate(val) {if (val == 1) {this.$refs.userForm.clearValidate('desc')}},submitForm(formName) {this.$refs.userForm.validate((valid) => {if (valid) {this.centerDialogVisible = true;} else {console.log('error submit!!');return false;}});},resetForm(formName) {//this.$refs[formName].resetFields();this.$refs.userForm.resetFields();}}
}
</script><style scoped>
.container {display: flex;justify-content: center;align-items: center;height: 100vh; /* 设置父容器的高度为视口高度,使其充满整个屏幕 */
}.center-container {max-width: 600px; /* 设置内部容器的最大宽度,根据需求进行调整 */
}
</style>

自定义校验函数

在这里插入图片描述

<template><div class="container"><div class="center-container"><el-form :model="userForm" :rules="rules" ref="userForm" label-width="100px"class="demo-userForm"><el-form-item label="提现金额" prop="amt"><el-input v-model="userForm.amt"></el-input></el-form-item><el-form-item label="证件类型" prop="idCardType"><el-select v-model="userForm.idCardType" placeholder="请选择证件类型"><el-option value="1" label="居民身份证"></el-option><el-option value="2" label="护照"></el-option></el-select></el-form-item><el-form-item label="证件号" prop="idCard"><el-input v-model="userForm.idCard"></el-input></el-form-item><el-form-item><el-button type="primary" @click="submitForm('userForm')">保 存</el-button><el-button @click="resetForm('userForm')">重 置</el-button></el-form-item></el-form></div><el-dialogtitle="提示":visible.sync="centerDialogVisible"width="30%"@close="closeDialog":close-on-click-modal="false":close-on-press-escape="false"center><span><pre>{{ userForm }}</pre></span><span slot="footer" class="dialog-footer"><el-button @click="centerDialogVisible = false">取 消</el-button><el-button type="primary" @click="centerDialogVisible = false">确 定</el-button></span></el-dialog></div>
</template><script>
import {cardid} from "@/utils/validate";export default {name: "validate-01",data() {let checkAmt = (rule, value, callback) => {if (value === '' || value === null) {callback(new Error('请输入提现金额'));} else if (value > 9999999.99) {//金额总长度不能大于10,包含小数点 value.toString().length > 10//数据库存储的类型为decimal(10,2),所以值不能大于9999999.99callback(new Error('提现金额不能大于9999999.99'));} else {callback();}}let checkIdCard = (rule, value, callback) => {if (!this.userForm.idCardType) {this.$refs.userForm.validateField('idCardType');} else {let idCardType = this.userForm.idCardType;if (idCardType == 1) {//居民身份证console.log(cardid(value))if (!cardid(value)[0]) {//todo 校验未成年callback();} else {callback(new Error(cardid(value)[1]))}} else if (idCardType == 2) {//护照let pattern = /^[a-zA-Z0-9]{3,20}$/;if (!pattern.test(value)) {callback(new Error("护照格式错误"))}} else {callback();}}}return {userForm: {idCard: '',idCardType: '',amt: '',},rules: {amt: [{required: true, message: '请输入提现金额', trigger: ['blur', 'change']},{pattern: /^\d+(\.\d{1,2})?$/, message: '金额格式错误', trigger: ['blur', 'change']},{validator: checkAmt, trigger: ['blur', 'change']}],idCardType: [{required: true, message: '请选择证件类型', trigger: ['blur']},],idCard: [{required: true, message: '请输入证件号', trigger: ['blur', 'change']},{validator: checkIdCard, trigger: ['blur', 'change']}],},centerDialogVisible: false,};},methods: {closeDialog() {this.centerDialogVisible = false;this.$refs.userForm.resetFields();},submitForm(formName) {this.$refs.userForm.validate((valid) => {if (valid) {this.centerDialogVisible = true;} else {console.log('error submit!!');return false;}});},resetForm(formName) {//this.$refs[formName].resetFields();this.$refs.userForm.resetFields();}}
}
</script><style scoped>
.container {display: flex;justify-content: center;align-items: center;height: 100vh; /* 设置父容器的高度为视口高度,使其充满整个屏幕 */
}.center-container {max-width: 600px; /* 设置内部容器的最大宽度,根据需求进行调整 */
}
</style>

动态列表表单

在这里插入图片描述

<template><div class="container"><div class="center-container"><el-form :model="{'contractData':contractData}" ref="contForm"><el-table :data="contractData" border style="width: 100%;" stripe><el-table-column label="序号" min-width="5%"><template slot-scope="scope"><p class="text-align:center;">{{ scope.$index + 1 }}</p></template></el-table-column><el-table-column prop="contName" label="合同名称" min-width="20%"><template slot-scope="scope"><el-form-item :prop="'contractData.'+scope.$index+'.contName'":rules="contRule.contName"><el-inputv-model.trim="scope.row.contName"placeholder="请输入合同名称" maxlength="200"></el-input></el-form-item></template></el-table-column><el-table-column label="合同编号" min-width="20%"><template slot-scope="scope"><el-form-item :prop="'contractData.'+scope.$index+'.contCode'":rules="contRule.contCode"><el-inputv-model.trim="scope.row.contCode" maxlength="200"placeholder="合同编号"></el-input></el-form-item></template></el-table-column></el-table><el-form-item><p><el-button @click="addCont()">添 加</el-button><el-button type="primary" @click="submitForm()">保 存</el-button><el-button @click="resetForm()">重 置</el-button></p></el-form-item></el-form></div><el-dialogtitle="提示":visible.sync="centerDialogVisible"width="30%"@close="closeDialog":close-on-click-modal="false":close-on-press-escape="false"center><span><pre>{{ contractData }}</pre></span><span slot="footer" class="dialog-footer"><el-button @click="centerDialogVisible = false">取 消</el-button><el-button type="primary" @click="centerDialogVisible = false">确 定</el-button></span></el-dialog></div>
</template><script>
export default {name: "validate-01",data() {return {contractData: [],contRule: {contCode: [{required: true,message: '合同编号不能为空',trigger: 'change'}],contAmt: [{required: true, message: '合同金额不能为空', trigger: 'change'},{pattern: /^(0\.0*[1-9]+[0-9]*$|[1-9]+[0-9]*\.[0-9]*[0-9]$|[1-9]+[0-9]*$)/,message: '非法数字'},{pattern: /^(([1-9]\d*)|\d)(\.\d{1,2})?$/,message: '最多两位小数'},],contName: [{required: true,message: '请输入合同名称',trigger: 'change'}],},centerDialogVisible: false,};},methods: {closeDialog() {this.centerDialogVisible = false;this.$refs.contForm.resetFields();},submitForm() {this.$refs.contForm.validate((valid) => {if (valid) {if (this.contractData.length === 0) {this.$message({showClose: true,message: '请先添加合同',type: 'warning',duration: 1500});} else {this.centerDialogVisible = true;}} else {console.log('error submit!!');return false;}});},resetForm() {//this.$refs[formName].resetFields();this.$refs.contForm.resetFields();},addCont() {this.contractData.push({contName: '',contCode: ''});}}
}
</script><style scoped></style>

文件校验

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

<template><div class="container"><div class="center-container"><el-form :model="userForm" :rules="rules" ref="userForm" label-width="100px"class="demo-userForm"><el-form-item label='附件' prop='fileList'><el-upload class='m-upload'action='/mock/user/img/upload':headers='headers'accept='.jpg,.png,.jpeg':on-success='handleAvatarSuccess':file-list='userForm.fileList':limit='2':on-exceed='handleExceed':on-preview='handlePreview':on-remove='handleRemove':before-upload="beforeAvatarUpload":before-remove="beforeRemove"><el-button type='primary'>上传</el-button></el-upload></el-form-item><el-form-item><el-button type="primary" @click="submitForm('userForm')">保 存</el-button><el-button @click="resetForm('userForm')">重 置</el-button></el-form-item></el-form></div><el-dialogtitle="提示":visible.sync="centerDialogVisible"width="30%"@close="closeDialog":close-on-click-modal="false":close-on-press-escape="false"center><span><pre>{{ userForm }}</pre></span><span slot="footer" class="dialog-footer"><el-button @click="centerDialogVisible = false">取 消</el-button><el-button type="primary" @click="centerDialogVisible = false">确 定</el-button></span></el-dialog></div>
</template><script>
import VueCookies from 'vue-cookies';export default {name: "validate-01",data() {return {userForm: {fileList: []},rules: {fileList: [{type: 'array', required: true, message: '请上传附件', trigger: ['change', 'blur']},{type: 'array', min: 2, message: '请至少上传2个附件', trigger: 'change'},],},centerDialogVisible: false,};},computed: {headers() {return {'Authorization': 'Bearer ' + VueCookies.get('access_token') // 直接从本地获取token就行};},},methods: {closeDialog() {this.centerDialogVisible = false;this.$refs.userForm.resetFields();},submitForm() {this.$refs.userForm.validate((valid) => {if (valid) {this.centerDialogVisible = true;} else {console.log('error submit!!');return false;}});},resetForm() {this.$refs.userForm.resetFields();},handleAvatarSuccess(response, file, fileList) {//上传成功console.log("response:", JSON.stringify(response))let self = this;let fileInfo = {...response.data};fileInfo.name = fileInfo.fileName;self.userForm.fileList.push(fileInfo);this.$refs.userForm.validateField("fileList")this.$forceUpdate();},handleExceed(files, fileList) {this.$message.warning('当前限制选择 2 个文件,本次选择了' + files.length + '个文件,共选择了' + (files.length + fileList.length) + ' 个文件');},handlePreview(val) {console.log("val:", JSON.stringify(val))},handleRemove() {this.userForm.fileList = [];},beforeAvatarUpload() {},beforeRemove() {}}
}
</script><style scoped>
.container {display: flex;justify-content: center;align-items: center;height: 100vh; /* 设置父容器的高度为视口高度,使其充满整个屏幕 */
}.center-container {max-width: 600px; /* 设置内部容器的最大宽度,根据需求进行调整 */
}
</style>

多表单el-form提交校验

使用Promise语法

在这里插入图片描述
在这里插入图片描述

<template><div class="container"><div class="center-container"><el-form :model="userForm1" :rules="rules" ref="userForm1" label-width="100px"class="demo-userForm"><span>基本信息1:</span><el-form-item label="姓名" prop="name"><el-input v-model="userForm1.name"></el-input></el-form-item></el-form><el-form :model="userForm2" :rules="rules" ref="userForm2" label-width="100px"class="demo-userForm"><span>基本信息2:</span><el-form-item label="姓名" prop="name"><el-input v-model="userForm2.name"></el-input></el-form-item></el-form><el-button type="primary" @click="submitForm()">保 存</el-button><el-button @click="resetForm()">重 置</el-button></div><el-dialogtitle="提示":visible.sync="centerDialogVisible"width="30%"@close="closeDialog":close-on-click-modal="false":close-on-press-escape="false"center><span><pre>{{ userForm1 }}</pre></span><span><pre>{{ userForm2 }}</pre></span><span slot="footer" class="dialog-footer"><el-button @click="centerDialogVisible = false">取 消</el-button><el-button type="primary" @click="centerDialogVisible = false">确 定</el-button></span></el-dialog></div>
</template><script>
export default {name: "validate-01",data() {return {userForm1: {},userForm2: {},rules: {name: [{required: true, message: '请输入姓名', trigger: ['blur', 'change']},{min: 2, max: 5, message: '长度在 2 到 5 个字符', trigger: 'blur'}],},centerDialogVisible: false,};},methods: {closeDialog() {this.centerDialogVisible = false;this.$refs.userForm1.resetFields();this.$refs.userForm2.resetFields();},submitForm() {const p1 = new Promise((resolve, reject) => {this.$refs['userForm1'].validate(valid => {if (valid) resolve()})})const p2 = new Promise((resolve, reject) => {this.$refs['userForm2'].validate(valid => {if (valid) resolve()})})Promise.all([p1, p2]).then(() => {console.log('submit')this.centerDialogVisible = true;})},resetForm() {this.$refs.userForm1.resetFields();this.$refs.userForm2.resetFields();}}
}
</script><style scoped>
.container {display: flex;justify-content: center;align-items: center;height: 100vh; /* 设置父容器的高度为视口高度,使其充满整个屏幕 */
}.center-container {max-width: 600px; /* 设置内部容器的最大宽度,根据需求进行调整 */
}
</style>

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

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

vue3 搭配ElementPlus做基础表单校验 自定义表单校验

<script setup> import { ref, reactive } from vue// 表单元素 const dom ref(null) // 校验规则 const rules {name: [{ required: true, message: 请输入活动名称, trigger: blur }],//校验手机号格式phone: [{ required: true, message: "请输入电话", t…

Jenkins详解(三)

Jenkins详解(三) 目录 Jenkins详解(三) 1、Jenkins介绍2、Jenkins CI/CD 流程3、部署环境 3.1 环境准备3.2 安装GitLab3.3 初始化GitLab3.4 GitLab中文社区版补丁包安装3.5 修改GitLab配置文件/etc/gitlab/gitlab.rb3.6 在宿主机输入 http://192.168.200.26:88 地址就可以访问了…

FreeRTOS操作系统中,断言输出 Error:..\..\FreeRTOS\portable\RVDS\ARM_CM4F\port.c,766 原因

分析&#xff1a;Error:..\..\FreeRTOS\portable\RVDS\ARM_CM4F\port.c,766 出现这个原因表示&#xff0c;你现在系统某个中断的优先级高于FreeRTOS可管理的优先级范围&#xff0c;一旦你这个中断触发&#xff0c;断言的信息即你串口就会输出这个条语句&#xff08;前提你串口…

LiveNVR监控流媒体Onvif/RTSP功能-支持数据库切换为高斯数据库信创瀚高数据信创数据库

LiveNVR监控流媒体Onvif/RTSP支持数据库切换为高斯数据库信创瀚高数据信创数据库 1、如何配置切换高斯数据库&#xff1f;2、如何配置切换信创瀚高数据库&#xff1f;3、RTSP/HLS/FLV/RTMP拉流Onvif流媒体服务 1、如何配置切换高斯数据库&#xff1f; livenvr.ini -> [db]下…

W5500-EVB-PICO进行MQTT连接订阅发布教程(十二)

前言 上一章我们用开发板通过SNTP协议获取网络协议&#xff0c;本章我们介绍一下开发板通过配置MQTT连接到服务器上&#xff0c;并且订阅和发布消息。 什么是MQTT&#xff1f; MQTT是一种轻量级的消息传输协议&#xff0c;旨在物联网&#xff08;IoT&#xff09;应用中实现设备…

港陆证券:五日线破位怎么看?

在股票交易中&#xff0c;五日线是个重要的技术指标之一&#xff0c;它能够反映出最近的商场趋势。假如五日线破位&#xff0c;这意味着商场呈现了趋势反转&#xff0c;出资者需求注重趋势改动&#xff0c;并采取相应的出资战略。 首先&#xff0c;咱们来看看五日线破位的原因…

一文讲透:erp系统是什么?

erp系统是什么&#xff1f;这个看似简单的问题还真不好解答。因为现在99%的人都把ERP“系统”和ERP“软件”混淆了&#xff01; ERP原本主要是专注于制造业的信息化问题&#xff0c;我把它叫真正的ERP“系统”。 但现在基本上只要是一个软件系统都可以叫ERP系统&#xff0c;什…

FreeRTOS中断与任务之间同步(Error:..\..\FreeRTOS\portable\RVDS\ARM_CM4F\port.c,422 )

前言&#xff1a; FreeRTOS中&#xff0c;中断需要注意几点&#xff1a; 何时使用中断&#xff1b;中断服务函数&#xff08;ISR&#xff09;要处理的数据量有多大&#xff0c;通常我们希望中断的切换越快越好&#xff0c;也就是说&#xff0c;ISR尽量采用耗时较少的处理方式…

SpringBoot v2.7.x+ 整合Swagger3入坑记?

目录 一、依赖 二、集成Swagger Java Config 三、配置完毕 四、解决方案 彩蛋 想尝鲜&#xff0c;坑也多&#xff0c;一起入个坑~ 一、依赖 SpringBoot版本&#xff1a;2.7.14 Swagger版本&#xff1a;3.0.0 <dependency><groupId>com.github.xiaoymin<…

【校招VIP】前端算法考点之大数据相关

考点介绍&#xff1a; 大数据的关键技术分为分析技术和处理技术&#xff0c;可用于大数据分析的关键技术主要包括A/B测试&#xff0c;关联规则挖掘&#xff0c;数据挖掘&#xff0c;集成学习&#xff0c;遗传算法&#xff0c;机器学习&#xff0c;自然语言处理&#xff0c;模式…

彻底学会Unity从网上加载资源到场景

使用类WWW 该类实例化的对象可以存储多种多媒体资源&#xff0c;只需要在构造函数中附上可访问的资源链接 Unity 中&#xff0c;WWW 类用于实例化互联网上的资源&#xff0c;如文本、图像、音频和视频等。WWW 实例化的对象可以存储多种多媒体素材。以下是一些常见的例子&…

C#,《小白学程序》第十一课:双向链表(Linked-List)其二,链表的插入与删除的方法(函数)与代码

1 文本格式 /// <summary> /// 改进的车站信息类 class /// 增加了 链表 需要的两个属性 Last Next /// </summary> public class StationAdvanced { /// <summary> /// 编号 /// </summary> public int Id { get; set; } 0; ///…