Vue+ElementUI+Axios实现携带参数的文件上传(数据校验+进度条)

news2024/9/30 13:28:17

Vue+ElementUI+Axios实现携带参数的文件上传(数据校验+进度条)

可以实现对上传文件的类型,大小进行数据校验,以及对上传文件所要携带的数据也进行的校验,也有文件上传进度的进度条。

一、Vue 结构部分

弹窗显示(文件上传框+文本框+单选按钮)

<template>
    <!-- 控制子组件显示还是隐藏: :visible.sync="isShow"  -->
    <div>
      <!-- 弹窗 -->
      <el-dialog width="30%" :modal="true" title="新增资源" :modal-append-to-body="true" :visible.sync="isShowAdd"
        :close-on-click-modal="false" :close-on-press-escape='false' :show-close="false" center>
            <!-- 需要上传的表单::model 和 ref 的值尽量保持一致,ref在的值在提交数据时进行对提交的数据进行校验 -->
        <el-form :model="ResourceInfo" ref="ResourceInfo" :rules="rules"  size="small" label-width="120px" label-position="right" key="1" :hide-required-asterisk="true">
          <el-form-item label="资源" >
            <!-- 文件上传:http-request这里用来获取到要上传的文件。limit限制文件个数。on-exceed:用来校验文件个数 ,before-remove:删除上传列表时提示用户-->
            <el-upload
            class="upload-demo" action="" ref="upload"  :http-request="httprequest" :limit=1 :drag="true" :on-exceed="handleExceed" :before-remove="beforeRemove">
                  <i class="el-icon-upload"></i>
                 <div class="el-upload__text">将文件拖到此处,或<em>点击选择文件</em></div>
                 </el-upload>
          </el-form-item>

          <!-- 文本框用来填写要上传一个参数,这里是为了给文件打标签 -->
          <el-form-item prop="tag"  label="标签">
            <el-input v-model="ResourceInfo.tag" ref="tag" maxlength="30" autocomplete="off"  placeholder="如:风景/天空"></el-input>
          </el-form-item>
          <!-- 单选框,也是文件的一个参数 -->
          <el-form-item prop="type" label="类型" >
            <el-radio-group v-model="ResourceInfo.type" ref="type">
              <el-radio border label="静态"></el-radio>
              <el-radio border label="动态"></el-radio>
            </el-radio-group>
          </el-form-item>
        </el-form>
       <!--进度条:只有上传时才显示-->
      <div v-if="loading" >
      <el-progress type="line" :percentage="percentage" class="progress" :show-text="true"></el-progress>
      </div>

      <!-- 上传和取消按钮 -->
        <div slot="footer" class="dialog-footer">
          <el-button @click="quxiao()">取 消</el-button>
          <!-- 调用上传文件方法,将填写的表单数据做为参数 -->
    <el-button type="primary" @click="submitFileInfo(ResourceInfo)">确 定</el-button>
        </div>
      </el-dialog>
    </div>
  </template>

二、JS部分

1、数据和数据校验部分
 <script> 
export default {
    name:"ResourceAdd",
    //组件是否显示(父组件传过来的)
    props: {
      isShowAdd: {
        type: Boolean,
        default: false
      },
  
    },
  
    data() {
  
      //数据校验
      var Type = (rule, value, callback) => {
              if (value === '') {
                  callback(new Error('请选择壁纸类型'));
                  this.islose = true;
              } else {
                  this.islose = false
                  callback();
              }
          };
     //数据校验
      var Tag = (rule, value, callback) => {
              if (value === '') {
                  callback(new Error('请添加标签'));
                  this.islose = true;
              } else if (value.length < 4) {
                  callback(new Error('最少输入4个字'));
                  this.islose = true;
              } else {
                  this.islose = false;
                  callback();
              }
          };
  
  
  
      return {
        resouceFileImg:null,
            loading:false,  //进度条是否隐藏
            percentage:0,   //进度条数值
            dialogVisible:false,  //是否上传完备
            //要上传文件的信息
        ResourceInfo: {
          "file":"",
          "tag":"",
          "type":""
        },
  
        //要校验的表单信息
        rules: { 
                  type: [
                      { validator: Type, trigger: 'blur'}
                  ],
                  tag: [
                  { validator: Tag, trigger: 'blur' }
                  ],
              },
      };
  
    },
 </script>
2、方法部分
<script>
  export default {
    methods: {
          submitFileInfo(resourceInfo){
            //调用文件类型判断方法,检查上传文件类型是否合法(返回Boolean类型)
           let fileTypeCheck=this.fileTypeCheck(resourceInfo.file)
          //  判断文件是否合法
           if(fileTypeCheck){
           //文件通过校验,校验其它要上传里其它参数是否合法
           this.$refs.ResourceInfo.validate((valid) => {
            if(valid){
              //如果都合法
            // 直接通过new来创建FormData对象,用来装文件对象和其它参数()
           let UpResourceInfo = new FormData();
           //通过append将数据添加到FormData中(数据是键值对类型)
           //注意:键要和后端接收的参数列表一一对应。
            UpResourceInfo.append('file', resourceInfo.file);
            UpResourceInfo.append("email",window.sessionStorage.getItem("Account"));
            UpResourceInfo.append("tag",resourceInfo.tag);
            UpResourceInfo.append("type",resourceInfo.type);

            //计算过上传进度
            // 进度条的实现主要依靠axios中提供的onUploadProgress函数
            //该函数提供了文件已上传部分的大小progressEvent.loaded和文件总大小progressEvent.total,利用这两个数据我们就可以计算出已经上传文件的进度。
            let config = {
              onUploadProgress: progressEvent => {
                //progressEvent.loaded:已上传文件大小
                //progressEvent.total:被上传文件的总大小
                let complete = (progressEvent.loaded / progressEvent.total ).toFixed(2) * 100 ;
                this.percentage = complete;   //上传进度
                if (this.percentage >= 100){
                  this.dialogVisible = true  //上传完毕
                }
               } 
              };

            //显示进度条
            this.loading = true;
            //通过axios对后端接口发起请求,并将上面的FormData对象参数发送过去,已经。
            axios.post("http://localhost:8888/resources/uploadResource",UpResourceInfo,config)
              .then((res)=>{
                if(res.data.flag==true){ 
                  //清空表单信息
                  this.ResourceInfo={
                            "file":"",
                           "tag":"",
                           "type":""
                           }
                    //清除上传文件列表
                  this.$refs.upload.clearFiles();
                  this.loading=false; //隐藏进度条
                  this.$message.success("添加成功!")
                 //调用父组件的方法隐藏弹窗
                 // this.$parent.AddSuccessColse(); 
                }
              })
              .catch((err)=>{
                this.$message.error(err)
                //清空表单信息
                this.ResourceInfo={};
                    //清除上传文件列表
                  this.$refs.upload.clearFiles();
                 //调用父组件的方法隐藏弹窗
                 //this.$parent.AddSuccessColse(); 
              })
            }
           });}
          },

          // 文件类型、大小数据校验
          fileTypeCheck(file) {
              const isJPG = file.type === 'image/jpg';
              const isJPEG = file.type === 'image/jpeg';
              const isPNG = file.type === 'image/png';
              const isMP4 = file.type === 'video/mp4';
              const isLt30M = file.size / 1024 / 1024 < 30;
              if (!isJPG && !isJPEG && !isPNG && !isMP4) {
                  this.$message.error('请上传 JPG、PNG、MP4格式文件!');
              } else 
              if (!isLt30M) {
                  this.$message.error('大小不能超过 30MB!');
              }
              return (isJPG || isPNG || isMP4 || isJPEG) && isLt30M;
          },

       //将上传的文件对象赋值到要上传的键值对中
       httprequest(param) {
        //将通过钩子函数函数,传过来的文件上传信息,中的文件赋值到要上传的键值对中
        this.ResourceInfo.file = param.file;
        },
  
       //取消时调用的方法
      quxiao() {
        this.$message.info("取消添加!");
        //清空表单信息
        this.ResourceInfo={
          "file":"",
          "tag": "",
          "type":""
        }
        this.$refs.upload.clearFiles();
        //通过调用父组件的方法来隐藏子组件(子组件无法修改父组件的值)
          this.$parent.AddQuXiaoColse();
      },
  
      //文件数量超过1个时自动调用的
      handleExceed(files, fileList) {
        this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
      },
      //是否删除文件列表中的文件(删除时自动调用)
      beforeRemove(file) {
        let isDel=this.$confirm(`确定移除 ${ file.name }`);
        console.log(isDel)
        return isDel;
      }

    },
  }
  </script>

三、后端代码(Springboot)

1、接口层方法(Controller)
 //资源上传接口
    @PostMapping("/uploadResource")
    public Result uploadResource(MultipartFile file,String email,String tag,String type){
        //生成UUID用来重新命名文件和做rid
        String uuid= UUID.randomUUID().toString().replaceAll("-","");
        Resource resource =new Resource();
        resource.setRid(uuid);
        resource.setEmail(email);
        resource.setTag(tag);
        resource.setType(type);
        return new Result(iResourceService.uploadResource(file,resource));
    }
2、服务层方法(Service)
//上传资源方法
    @Override
    public Boolean uploadResource(MultipartFile file, Resource resource) {

        if(!file.isEmpty()){
            String  fullName = file.getOriginalFilename();  //获取全文件名
            String type = fullName.substring(file.getOriginalFilename().lastIndexOf(".")); //获取文件后缀
            String fileName=resource.getRid()+type;  //拼接新文件名
            //获取上传目录路径
            ApplicationHome applicationHome=new ApplicationHome(this.getClass());
            String pre=applicationHome.getDir().getParentFile().getParentFile()+
                    "\\src\\main\\resources\\static\\wallpaper\\";
            //拼接上传路径
            String path=pre+fileName;
            try {
                //将文件上传到指定目录
                file.transferTo(new File(path));
                //将文件拼接成可访问的在线链接,并赋值到对象的setRUrl属性中
                resource.setRUrl("http://localhost:8888/static/wallpaper/"+fileName);
            }catch (IOException e){
                e.printStackTrace();
            }
        }
        //将图像信息插入到数据库中
        return resourceDao.insert(resource)==1;

    }
3、数据库数据

在这里插入图片描述

四、前端组件全部代码(ResourceAdd.vue)

效果图如下:

在这里插入图片描述

<template>
    <!-- 控制子组件显示还是隐藏: :visible.sync="isShow"  -->
    <div>
      <!-- 弹窗 -->
      <el-dialog width="30%" :modal="true" title="新增资源" :modal-append-to-body="true" :visible.sync="isShowAdd"
        :close-on-click-modal="false" :close-on-press-escape='false' :show-close="false" center>
            <!-- 需要上传的表单::model 和 ref 的值尽量保持一致,ref在的值在提交数据时进行对提交的数据进行校验 -->
        <el-form :model="ResourceInfo" ref="ResourceInfo" :rules="rules"  size="small" label-width="120px" label-position="right" key="1" :hide-required-asterisk="true">
          <el-form-item label="资源" >
            <!-- 文件上传:http-request这里用来获取到要上传的文件。limit限制文件个数。on-exceed:用来校验文件个数 ,before-remove:删除上传列表时提示用户-->
            <el-upload
            class="upload-demo" action="" ref="upload"  :http-request="httprequest" :limit=1 :drag="true" :on-exceed="handleExceed" :before-remove="beforeRemove">
                  <i class="el-icon-upload"></i>
                 <div class="el-upload__text">将文件拖到此处,或<em>点击选择文件</em></div>
                 </el-upload>
          </el-form-item>

          <!-- 文本框用来填写要上传一个参数,这里是为了给文件打标签 -->
          <el-form-item prop="tag"  label="标签">
            <el-input v-model="ResourceInfo.tag" ref="tag" maxlength="30" autocomplete="off"  placeholder="如:风景/天空"></el-input>
          </el-form-item>
          <!-- 单选框,也是文件的一个参数 -->
          <el-form-item prop="type" label="类型" >
            <el-radio-group v-model="ResourceInfo.type" ref="type">
              <el-radio border label="静态"></el-radio>
              <el-radio border label="动态"></el-radio>
            </el-radio-group>
          </el-form-item>
        </el-form>
       <!--进度条:只有上传时才显示-->
      <div v-if="loading" >
      <el-progress type="line" :percentage="percentage" class="progress" :show-text="true"></el-progress>
      </div>

      <!-- 上传和取消按钮 -->
        <div slot="footer" class="dialog-footer">
          <el-button @click="quxiao()">取 消</el-button>
          <!-- 调用上传文件方法,将填写的表单数据做为参数 -->
          <el-button type="primary" @click="submitFileInfo(ResourceInfo)">确 定</el-button>
        </div>
      </el-dialog>
    </div>
  </template>

  <script>
  export default {
    name:"ResourceAdd",
    //组件是否显示(父组件传过来的)
    props: {
      isShowAdd: {
        type: Boolean,
        default: false
      },
  
    },
  
    data() {
  
      //数据校验
      var Type = (rule, value, callback) => {
              if (value === '') {
                  callback(new Error('请选择壁纸类型'));
                  this.islose = true;
              } else {
                  this.islose = false
                  callback();
              }
          };
     //数据校验
      var Tag = (rule, value, callback) => {
              if (value === '') {
                  callback(new Error('请添加标签'));
                  this.islose = true;
              } else if (value.length < 4) {
                  callback(new Error('最少输入4个字'));
                  this.islose = true;
              } else {
                  this.islose = false;
                  callback();
              }
          };
  
  
  
      return {
        resouceFileImg:null,
            loading:false,  //进度条是否隐藏
            percentage:0,   //进度条数值
            dialogVisible:false,  //是否上传完备
            //要上传文件的信息
        ResourceInfo: {
          "file":"",
          "tag":"",
          "type":""
        },
  
        //要校验的表单信息
        rules: { 
                  type: [
                      { validator: Type, trigger: 'blur'}
                  ],
                  tag: [
                  { validator: Tag, trigger: 'blur' }
                  ],
              },
      };
  
    },
    methods: {
          submitFileInfo(resourceInfo){
            //调用文件类型判断方法,检查上传文件类型是否合法(返回Boolean类型)
           let fileTypeCheck=this.fileTypeCheck(resourceInfo.file)
          //  判断文件是否合法
           if(fileTypeCheck){
           //文件通过校验,校验其它要上传里其它参数是否合法
           this.$refs.ResourceInfo.validate((valid) => {
            if(valid){
              //如果都合法
            // 直接通过new来创建FormData对象,用来装文件对象和其它参数()
           let UpResourceInfo = new FormData();
           //通过append将数据添加到FormData中(数据是键值对类型)
           //注意:键要和后端接收的参数列表一一对应。
            UpResourceInfo.append('file', resourceInfo.file);
            UpResourceInfo.append("email",window.sessionStorage.getItem("Account"));
            UpResourceInfo.append("tag",resourceInfo.tag);
            UpResourceInfo.append("type",resourceInfo.type);

            //计算过上传进度
            // 进度条的实现主要依靠axios中提供的onUploadProgress函数
            //该函数提供了文件已上传部分的大小progressEvent.loaded和文件总大小progressEvent.total,利用这两个数据我们就可以计算出已经上传文件的进度。
            let config = {
              onUploadProgress: progressEvent => {
                //progressEvent.loaded:已上传文件大小
                //progressEvent.total:被上传文件的总大小
                let complete = (progressEvent.loaded / progressEvent.total ).toFixed(2) * 100 ;
                this.percentage = complete;   //上传进度
                if (this.percentage >= 100){
                  this.dialogVisible = true  //上传完毕
                }
               } 
              };

            //显示进度条
            this.loading = true;
            //通过axios对后端接口发起请求,并将上面的FormData对象参数发送过去,已经。
            axios.post("http://localhost:8888/resources/uploadResource",UpResourceInfo,config)
              .then((res)=>{
                if(res.data.flag==true){ 
                  //清空表单信息
                  this.ResourceInfo={
                            "file":"",
                           "tag":"",
                           "type":""
                           }
                    //清除上传文件列表
                  this.$refs.upload.clearFiles();
                  this.loading=false; //隐藏进度条
                  this.$message.success("添加成功!")
                 //调用父组件的方法隐藏弹窗
                 // this.$parent.AddSuccessColse(); 
                }
              })
              .catch((err)=>{
                this.$message.error(err)
                //清空表单信息
                this.ResourceInfo={};
                    //清除上传文件列表
                  this.$refs.upload.clearFiles();
                 //调用父组件的方法隐藏弹窗
                 //this.$parent.AddSuccessColse(); 
              })
            }
           });}
          },

          // 文件类型、大小数据校验
          fileTypeCheck(file) {
              const isJPG = file.type === 'image/jpg';
              const isJPEG = file.type === 'image/jpeg';
              const isPNG = file.type === 'image/png';
              const isMP4 = file.type === 'video/mp4';
              const isLt30M = file.size / 1024 / 1024 < 30;
              if (!isJPG && !isJPEG && !isPNG && !isMP4) {
                  this.$message.error('请上传 JPG、PNG、MP4格式文件!');
              } else 
              if (!isLt30M) {
                  this.$message.error('大小不能超过 30MB!');
              }
              return (isJPG || isPNG || isMP4 || isJPEG) && isLt30M;
          },

       //将上传的文件对象赋值到要上传的键值对中
       httprequest(param) {
        //将通过钩子函数函数,传过来的文件上传信息,中的文件赋值到要上传的键值对中
        this.ResourceInfo.file = param.file;
        },
  
       //取消时调用的方法
      quxiao() {
        this.$message.info("取消添加!");
        //清空表单信息
        this.ResourceInfo={
          "file":"",
          "tag": "",
          "type":""
        }
        this.$refs.upload.clearFiles();
        //通过调用父组件的方法来隐藏子组件(子组件无法修改父组件的值)
          this.$parent.AddQuXiaoColse();
      },
  
      //文件数量超过1个时自动调用的
      handleExceed(files, fileList) {
        this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
      },
      //是否删除文件列表中的文件(删除时自动调用)
      beforeRemove(file) {
        let isDel=this.$confirm(`确定移除 ${ file.name }`);
        console.log(isDel)
        return isDel;
      }

    },
  }
  </script>

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

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

相关文章

Jenkins 问题

从gitlab 仓库拉去代码到Jenkins本地报错 ERROR: Couldn’t find any revision to build. Verify the repository and branch configuration for this job. 问题原因&#xff1a; 创建条目》配置的时候&#xff0c;gitlab仓库不存在master分支 修复后&#xff1a;

[每周一更]-(第82期):认识自然处理语言(NLP)

GPT的大火&#xff0c;带起了行业内大模型的爆发&#xff1b;国内外都开始拥有或者研发自己的大模型&#xff0c;下边我们从NLP来进一步深入了解大模型、AI。 一、什么是NLP&#xff1f; 自然语言处理&#xff08;英语&#xff1a;Natural Language Processing&#xff0c;缩…

2000年第五次人口普查数据,shp/excel格式均有,划分年龄段、性别占比等字段

基本信息. 数据名称: 第五次人口普查数据 数据格式: Shp、excel 数据时间: 2000年 数据几何类型: 面 数据坐标系: WGS84坐标系 数据来源&#xff1a;第五次人口普查数据 数据字段&#xff1a; 序号字段名称字段说明1a2000_zrks2000年_常住人口&#xff08;人&…

Pycharm close project 速度缓慢解决办法

解决Pycharm close project缓慢现象 1.问题描述 close project后需要等待很长的时间。 2.解决办法 在Help -> Find Action -> 输入 Registry -> 禁用ide.await.scope.completion 问题解决&#xff01;&#xff01;&#xff01; &#x1f603;&#x1f603;&#x…

C++(10)——模板

目录 1.什么是泛式编程以及模板的引入&#xff1a; 2. 模板&#xff1a; 2.1 函数模板&#xff1a; 2.2 类模板&#xff1a; 1.什么是泛式编程以及模板的引入&#xff1a; 在之前排序的部分中&#xff0c;为了完成某个特定功能&#xff0c;经常会用到交换函数&#xff0c;即…

Tensorflow2.0笔记 - 修改形状和维度

本次笔记主要使用reshape&#xff0c;transpose&#xff0c;expand_dim&#xff0c;和squeeze对tensor的形状和维度进行操作。 import tensorflow as tf import numpy as nptf.__version__#tensor的shape和维数获取 #假设下面这个tensor表示4张28*28*3的图片 tensor tf.rando…

Android代码混淆

Android之代码混淆 代码混淆的作用设置混淆1. 在模块目录下的 build.gradle 文件中配置以下代码2. 在 proguard-rules.pro 文件中添加混淆规则 通用混淆规则常用匹配符常用命令注意事项如何查看是否已混淆 代码混淆的作用 1.令 APK 难以被逆向工程&#xff0c;即很大程度上增加…

JVM 内存布局

内存区域分布介绍&#xff1a; jvm内存布局是理解Java应用程序运行时内存管理的重要一部分。JVM内存分为几个区域&#xff0c;每个区域有不同的作用。以下是JVM内存布局详细说明&#xff1a; JVM内存分布图&#xff1a; JVM内存区域详细说明&#xff1a; 方法区&#xff08;M…

遥感影像-语义分割数据集:Landsat8云数据集详细介绍及训练样本处理流程

原始数据集详情 简介&#xff1a;该云数据集包括RGB三通道的高分辨率图像&#xff0c;在全球不同区域的分辨率15米。这些图像采集自Lansat8的五种主要土地覆盖类型&#xff0c;即水、植被、湿地、城市、冰雪和贫瘠土地。 KeyValue卫星类型landsat8覆盖区域未知场景水、植被、…

Docker之概述与安装

&#x1f389;&#x1f389;欢迎来到我的CSDN主页&#xff01;&#x1f389;&#x1f389; &#x1f3c5;我是君易--鑨&#xff0c;一个在CSDN分享笔记的博主。&#x1f4da;&#x1f4da; &#x1f31f;推荐给大家我的博客专栏《Docker之概述与安装》。&#x1f3af;&#x1f…

笔记系统的部署架构

前天给笔记系统打了0.0.3的tag&#xff0c;一个简单的全栈功能闭环基本完成。既然是开源&#xff0c;因此&#xff0c;这里有必要分享一下部署结构&#xff0c;希望能够获得小伙伴们的反馈。 目前整个系统采用docker容器来部署。应用介绍 auth_app: 登录/注册的前端应用 web_ap…

9个自媒体音频创作平台(附链接通道)

​划到最后“阅读原文” ——进入官网 Hi&#xff0c;我是胡猛夫&#xff0c;每天分享实用运营工具&#xff01; 更多资源&#xff0c;更多内容&#xff0c;欢迎交流&#xff01;公 号 | 微视角文化 》》精彩推荐 >>微视角文化知识库&#xff1a;移动的自媒体运营百科全…

【Python机器学习】深度学习——调参

先用MLPClassifier应用到two_moons数据集上&#xff1a; from sklearn.neural_network import MLPClassifier from sklearn.datasets import make_moons from sklearn.model_selection import train_test_split import mglearn import matplotlib.pyplot as pltplt.rcParams[f…

UOS Python+Qt5实现声卡回路测试

1.回路治具设计&#xff1a; 2.Ui界面&#xff1a; 3.源代码&#xff1a; # -*- coding: utf-8 -*-# Form implementation generated from reading ui file SoundTestWinFrm.ui # # Created by: PyQt5 UI code generator 5.15.2 # # WARNING: Any manual changes made to this…

【VRTK】【Unity】【游戏开发】更多技巧

课程配套学习项目源码资源下载 https://download.csdn.net/download/weixin_41697242/88485426?spm=1001.2014.3001.5503 【概述】 本篇将较为零散但常用的VRTK开发技巧集合在一起,主要内容: 创建物理手震动反馈高亮互动对象【创建物理手】 非物理手状态下,你的手会直接…

BikeDNA(四)初始化参考数据

BikeDNA&#xff08;四&#xff09;初始化参考数据 这本笔记本&#xff1a; 加载定义研究区域的多边形&#xff0c;然后为研究区域创建网格叠加。加载参考数据。处理参考数据以创建分析所需的网络结构和属性。 先决条件和条件 输入/输出 config.yml 必须提前设置。 此笔记本…

力扣|2023华为秋招冲刺

文章目录 第一关&#xff1a;2023 年 7 月面试题挑战第二关&#xff1a;2023 年 6 月面试题挑战第三关&#xff1a;2023 年 5 月面试题挑战 第一关&#xff1a;2023 年 7 月面试题挑战 class Solution { public:void reverseWord(vector<char>& s,int l,int r){for(i…

教程-右键用vscode(新窗口)打开文件或目录

通过本文可以提高效率&#xff0c;用起来更爽更高效。 本文实现了&#xff08;windows系统&#xff09;&#xff1a; 右键-用vscode(当前窗口)打开文件或目录右键-用vscode-新窗口打开文件或目录 注意&#xff1a; 下面的安装路径要更改为您实际的路径 具体配置步骤&#x…

066:vue中实现二维数组的全选、全不选、反选、部分全选功能(图文示例)

第061个 查看专栏目录: VUE ------ element UI 专栏目标 在vue和element UI联合技术栈的操控下,本专栏提供行之有效的源代码示例和信息点介绍,做到灵活运用。 (1)提供vue2的一些基本操作:安装、引用,模板使用,computed,watch,生命周期(beforeCreate,created,beforeM…

面向零信任架构的访问安全态势评估

伴随着“云大物移”等新兴 IT 技术的快速发展&#xff0c;企业数字化转型使得 IT 业务的网络环境更加复杂多样&#xff0c;企业数字资源的安全防护正面临着前所未有的压力与威胁。零信任安全架构放弃了传统基于“边界”的安全模型&#xff0c;以访问上下文的安全态势感知为基础…