Vue | (三)使用Vue脚手架(下)| 尚硅谷Vue2.0+Vue3.0全套教程

news2025/3/10 11:07:11

文章目录

  • 📚Vue 中的自定义事件
    • 🐇使用方法
    • 🐇案例练习
    • 🐇TodoList案例优化
  • 📚全局事件总线
    • 🐇使用方法
    • 🐇案例练习
    • 🐇TodoList案例优化
  • 📚消息订阅与发布
    • 🐇使用方法
    • 🐇TodoList案例优化
      • ⭐️把删除一个todo(`deleteTodo`)改成消息订阅与发布
      • ⭐️添加编辑todo效果
      • ⭐️内容不为空限制
      • ⭐️点击编辑按钮自动获取焦点
  • 📚Vue封装的过度与动画
    • 🐇使用方法
    • 🐇案例练习
    • 🐇TodoList案例优化

学习链接:尚硅谷Vue2.0+Vue3.0全套教程丨vuejs从入门到精通,本文对应p79-p95,博客参考尚硅谷公开笔记,补充记录实操。

📚Vue 中的自定义事件

🐇使用方法

  • 区别于JS里的内置事件。

  • 一种组件间通信的方式,适用于:子组件 ===> 父组件

  • 使用场景:A是父组件,B是子组件,B想给A传数据,那么就要在A中给B绑定自定义事件(事件的回调在A中)。

  • 绑定自定义事件:

    • 第一种方式,在父组件中:<Demo @atguigu="test"/><Demo v-on:atguigu="test"/>
    • 第二种方式,在父组件中:
      <Demo ref="demo"/>
      ......
      mounted(){
         this.$refs.xxx.$on('atguigu',this.test)
      }
      
  • 若想让自定义事件只能触发一次,可以使用once修饰符,或$once方法。

  • 触发自定义事件:this.$emit('atguigu',数据)

  • 解绑自定义事件this.$off('atguigu'),多个一起解绑套在一个数组里。this.$off() ,解绑所有的自定义事件。

  • 组件上也可以绑定原生DOM事件,需要使用native修饰符。

  • 注意:通过this.$refs.xxx.$on('atguigu',回调)绑定自定义事件时,回调要么配置在methods中要么用箭头函数,否则this指向会出问题!


🐇案例练习

  • 案例实现,实操见真知😄
  • Student-Test.vue
    <template>
    	<div class="student">
    		<h2>学生姓名:{{name}}</h2>
    		<h2>学生性别:{{sex}}</h2>
    		<h2>当前求和为:{{number}}</h2>
    		<button @click="add">点我number++</button>
    		<button @click="sendStudentlName">把学生名给App</button>
    		<button @click="unbind">解绑atguigu事件</button>
    		<button @click="death">销毁当前Student组件的实例(vc)</button>
    	</div>
    </template>
    
    <script>
    	export default {
    		name:'Student-Test',
    		data() {
    			return {
    				name:'右一',
    				sex:'女',
    				number:0
    			}
    		},
    		methods: {
    			add(){
    				console.log('add回调被调用了')
    				this.number++
    			},
    			sendStudentlName(){
    				//触发Student组件实例身上的atguigu事件
    				this.$emit('atguigu',this.name,666,888,900)
    				// this.$emit('demo')
    				// this.$emit('click')
    			},
    			unbind(){
    				this.$off('atguigu') //解绑一个自定义事件
    				console.log('解绑了')
    				// this.$off(['atguigu','demo']) //解绑多个自定义事件(写在一个数组里)
    				// this.$off() //解绑所有的自定义事件
    			},
    			death(){
    				//销毁了当前Student组件的实例,销毁后所有Student实例的自定义事件全都不奏效。
    				//和视频里展示的不一样,现在销毁后原生num++也不奏效了,不论是console还是响应式。
    				this.$destroy() 
    				console.log('销毁了')
    			}
    		},
    	}
    </script>
    
    <style scoped>
    	.student{
    		background-color: pink;
    		padding: 5px;
    		margin-top: 30px;
    	}
    </style>
    
  • School-Test.vue
    <template>
    	<div class="school">
    		<h2>学校名称:{{name}}</h2>
    		<h2>学校地址:{{address}}</h2>
    		<button @click="sendSchoolName">把学校名给App</button>
    	</div>
    </template>
    
    <script>
    	export default {
    		name:'School-Test',
    		props:['getSchoolName'],
    		data() {
    			return {
    				name:'哔哩哔哩大学',
    				address:'bilibili',
    			}
    		},
    		methods: {
    			sendSchoolName(){
    				this.getSchoolName(this.name)
    			}
    		},
    	}
    </script>
    
    <style scoped>
    	.school{
    		background-color: skyblue;
    		padding: 5px;
    	}
    </style>
    
  • App.vue
    <template>
    	<div class="app">
    		<h1>{{msg}}学生姓名是:{{studentName}}</h1>
    
    		<!-- 通过父组件给子组件传递函数类型的props实现:子给父传递数据 -->
    		<School :getSchoolName="getSchoolName"/>
    
    		<!-- 通过父组件给子组件绑定一个自定义事件实现:子给父传递数据(第一种写法,使用@或v-on) -->
    		<!-- <Student @atguigu="getStudentName" @demo="m1"/> -->
    
    		<!-- 通过父组件给子组件绑定一个自定义事件实现:子给父传递数据(第二种写法,使用ref) -->
    		<Student ref="student" @click.native="show"/>
    	</div>
    </template>
    
    <script>
    	import Student from './components/Student-Test'
    	import School from './components/School-Test'
    
    	export default {
    		name:'App',
    		components:{School,Student},
    		data() {
    			return {
    				msg:'你好啊!',
    				studentName:''
    			}
    		},
    		methods: {
    			getSchoolName(name){
    				console.log('App收到了学校名:',name)
    			},
    			getStudentName(name,...params){
    				console.log('App收到了学生名:',name,params)
    				this.studentName = name
    			},
    			m1(){
    				console.log('demo事件被触发了!')
    			},
    			show(){
    				alert(123)
    			}
    		},
    		mounted() {
    			this.$refs.student.$on('atguigu',this.getStudentName) //绑定自定义事件
    			// this.$refs.student.$once('atguigu',this.getStudentName) //绑定自定义事件(一次性)
    		},
    	}
    </script>
    
    <style scoped>
    	.app{
    		background-color: gray;
    		padding: 5px;
    	}
    </style>
    
  • num++
    在这里插入图片描述
  • 发送学生名在这里插入图片描述
  • 解绑
    在这里插入图片描述
  • 解绑后学生名发不出去了
    在这里插入图片描述
  • 销毁
    在这里插入图片描述
  • num++可点击,但不奏效
    在这里插入图片描述

🐇TodoList案例优化

  • 所有涉及到子组件给父组件传输的:
    • 添加一个todo,addTodo
    • 底部全选,checkAllTodo
    • 清除已完成,clearAllTodo
    • addTodo为例,
      • 首先,在App.vue中把:addTodo="addTodo"改为@addTodo="addTodo"
      • 而后在UserHeader中把props去除(不用接收了)。
      • 功能实现处:
        // 通知APP组件去添加一个todo对象
        this.$emit('addTodo',todoObj)
        

📚全局事件总线

🐇使用方法

  1. 一种组件间通信的方式,适用于任意组件间通信

  2. 安装全局事件总线

    new Vue({
    	......
    	beforeCreate() {
    		Vue.prototype.$bus = this //安装全局事件总线,$bus就是当前应用的vm
    	},
        ......
    }) 
    
  3. 使用事件总线

    • 接收数据:A组件想接收数据,则在A组件中给$bus绑定自定义事件,事件的回调留在A组件自身

      methods(){
        demo(data){......}
      }
      ......
      mounted() {
        this.$bus.$on('xxxx',this.demo)
      }
      
    • 提供数据:this.$bus.$emit('xxxx',数据)

  4. 最好在beforeDestroy钩子中,用$off去解绑当前组件所用到的事件。


🐇案例练习

  • main.js:安装全局事件总线。
    //引入Vue
    import Vue from 'vue'
    //引入App
    import App from './App.vue'
    //关闭Vue的生产提示
    Vue.config.productionTip = false
    
    //创建vm
    new Vue({
    	el:'#app',
    	render: h => h(App),
    	beforeCreate() {
    		Vue.prototype.$bus = this //安装全局事件总线
    	},
    })
    
  • Student-Test.vue:提供数据。
    <template>
    	<div class="student">
    		<h2>学生姓名:{{name}}</h2>
    		<h2>学生性别:{{sex}}</h2>
    		<button @click="sendStudentName">把学生名给School组件</button>
    	</div>
    </template>
    
    <script>
    	export default {
    		name:'Student-Test',
    		data() {
    			return {
    				name:'youyi',
    				sex:'女',
    			}
    		},
    		methods: {
    			sendStudentName(){
    				this.$bus.$emit('hello',this.name)
    			}
    		},
    	}
    </script>
    
    <style scoped>
    	.student{
    		background-color: pink;
    		padding: 5px;
    		margin-top: 30px;
    	}
    </style>
    
  • School-Test.vue:接收数据。
    <template>
    	<div class="school">
    		<h2>学校名称:{{name}}</h2>
    		<h2>学校地址:{{address}}</h2>
    	</div>
    </template>
    
    <script>
    	export default {
    		name:'School-Test',
    		data() {
    			return {
    				name:'哔哩哔哩大学',
    				address:'bilibili',
    			}
    		},
    		mounted() {
    			// console.log('School',this)
    			this.$bus.$on('hello',(data)=>{
    				console.log('我是School组件,收到了数据',data)
    			})
    		},
    		beforeDestroy() {
    			this.$bus.$off('hello')
    		},
    	}
    </script>
    
    <style scoped>
    	.school{
    		background-color: skyblue;
    		padding: 5px;
    	}
    </style>
    
    在这里插入图片描述

🐇TodoList案例优化

  • 把“爷孙”之间的改成全局事件总线:
    • 勾选一个todo,checkTodo
    • 删除一个todo,deleteTodo
    • 修改点:
      • 在main.js安装全局事件总线
        new Vue({
        	el:'#app',
        	render: h => h(App),
        	beforeCreate(){
        		Vue.prototype.$bus = this
        	}
        })
        
      • checkTododeleteTodo不用给List传了,List对应也不用接收了。同样的,List也不用给Item,后者也不收了。也就是之前的层级传递过程删掉。
      • 收数据的(App.vue)绑定事件总线。
        mounted(){
        	this.$bus.$on('checkTodo',this.checkTodo)
        	this.$bus.$on('deleteTodo',this.deleteTodo)
        },
        beforeDestroy(){
        	this.$bus.$off('checkTodo')
        	this.$bus.$off('deleteTodo')
        }
        
      • Item提供数据。
        methods:{
            // 勾选or取消勾选
            handleCheck(id){
                // 通知App组件将对应的todo对象的done值取反
                this.$bus.$emit('checkTodo',id)
            },
            // 删除
            handleDelete(id){
                if(confirm('确定删除吗?')){
                    // 通知App组件删除
                    this.$bus.$emit('deleteTodo',id)
                }
            }
        }
        

📚消息订阅与发布

🐇使用方法

  1. 一种组件间通信的方式,适用于任意组件间通信

  2. 使用步骤

    • 安装pubsub:npm i pubsub-js
    • 引入: import pubsub from 'pubsub-js'
    • 接收数据:A组件想接收数据,则在A组件中订阅消息,订阅的回调留在A组件自身
      methods(){
        demo(data){......}
      }
      ......
      mounted() {
        this.pid = pubsub.subscribe('xxx',this.demo) //订阅消息
      }
      
    1. 提供数据pubsub.publish('xxx',数据)

    2. 最好在beforeDestroy钩子中,用PubSub.unsubscribe(pid)取消订阅

🐇TodoList案例优化

⭐️把删除一个todo(deleteTodo)改成消息订阅与发布

  • 引入pubsub库(用到的vue都需要引入),import pubsub from 'pubsub-js'
  • App.vue需要数据,订阅消息。这里需要methods里deleteTodo(_,id)_占个位。
    mounted(){
    	this.$bus.$on('checkTodo',this.checkTodo)
    	this.pubId = pubsub.subscribe('deleteTodo',this.deleteTodo)
    },
    beforeDestroy(){
    	this.$bus.$off('checkTodo')
    	pubsub.unsubscribe(this.pubId)
    }
    
  • UserItem.vue提供数据。
    methods:{
        // 勾选or取消勾选
        handleCheck(id){
            // 通知App组件将对应的todo对象的done值取反
            this.$bus.$emit('checkTodo',id)
        },
        // 删除
        handleDelete(id){
            if(confirm('确定删除吗?')){
                // 通知App组件删除
                pubsub.publish('deleteTodo',id)
            }
        }
    }
    

⭐️添加编辑todo效果

  • UserItem.vue样式添加编辑按钮。
    在这里插入图片描述
  • UserItem.vue
    <template>
        <li>
            <label>
                <input type="checkbox" :checked="fasong.done" @change="handleCheck(fasong.id)"/>
                <span v-show="!fasong.isEdit">{{fasong.title}}</span>
                <input 
                    type="text" 
                    v-show="fasong.isEdit" 
                    :value="fasong.title"
                    @blur="handleBlur(fasong,$event)"
                >
            </label>
            <button class="btn btn-danger" @click="handleDelete(fasong.id)">删除</button>
            <button v-show="!fasong.isEdit" class="btn btn-edit" @click="handleEdit(fasong)">编辑</button>
        </li>
    </template>
    
    <script>
        import pubsub from 'pubsub-js'
        export default {
            name:'UserItem',
            // 声明接收发送内容
            props:['fasong'],
            methods:{
                // 勾选or取消勾选
                handleCheck(id){
                    // 通知App组件将对应的todo对象的done值取反
                    this.$bus.$emit('checkTodo',id)
                },
                // 删除
                handleDelete(id){
                    if(confirm('确定删除吗?')){
                        // 通知App组件删除
                        pubsub.publish('deleteTodo',id)
                    }
                },
                //编辑
                handleEdit(fasong){
                    // 已经有了isEdit
                    if(fasong.hasOwnProperty.call('isEdit')){
                        fasong.isEdit = true
                    }else{
                        this.$set(fasong,'isEdit',true)
                    }
                },
                // 失去焦点回调(真正执行修改)
                handleBlur(fasong,e){
                    fasong.isEdit = false
                    this.$bus.$emit('updateTodo',fasong.id,e.target.value)
                }
            }
        }
    </script>
    
  • App.vue
    <template>
    	<div id="root">
    		<div class="todo-container">
    			<div class="todo-wrap">
    				<UserHeader @addTodo="addTodo"></UserHeader>
    				<UserList :todos="todos"></UserList>
    				<UserFooter :todos="todos" @checkAllTodo="checkAllTodo" @clearAllTodo="clearAllTodo"></UserFooter>
    			</div>
    		</div>
    	</div>
    
    </template>
    
    <!-- App.vue -->
    <script>
    	import pubsub from 'pubsub-js'
    	import UserHeader from './components/UserHeader.vue'
    	import UserList from './components/UserList'
    	import UserFooter from './components/UserFooter'
    	
    	export default {
    		name:'App',
    		components:{UserHeader,UserList,UserFooter},
    		data(){
                return{
                    todos:JSON.parse(localStorage.getItem('todos')) || []
                }
            },
    		methods:{
    			// 数据在哪,对数据的操作就在哪
    			// 添加一个todo
    			addTodo(todoObj){
    				this.todos.unshift(todoObj)
    			},
    			// 勾选or取消勾选一个todo
    			checkTodo(id){
    				this.todos.forEach((todo)=>{
    					if(todo.id === id) todo.done = !todo.done
    				})
    			},
    			// 修改一个todo
    			updateTodo(id,title){
    				this.todos.forEach((todo)=>{
    					if(todo.id === id) todo.title = title
    				})
    			},
    			// 删除一个todo
    			deleteTodo(_,id){
    				// this.todos = this.todos.filter((todo)=>{
    				// 	return todo.id !== id
    				// })
    				// 精简写法
    				this.todos = this.todos.filter(todo => todo.id != id)
    			},
    			// 全选or取消全选
    			checkAllTodo(done){
    				this.todos.forEach((todo)=>{
    					todo.done = done
    				})
    			},
    			// 清除所有已经完成的todo
    			clearAllTodo(){
    				this.todos = this.todos.filter((todo)=>{
    					return !todo.done
    				})
    			}
    		},
    		watch:{
    			todos:{
    				// 开启深度监视
    				deep:true,
    				handler(value){
    					localStorage.setItem('todos',JSON.stringify(value))
    				}
    			}
    		},
    		mounted(){
    			this.$bus.$on('checkTodo',this.checkTodo)
    			this.$bus.$on('updateTodo',this.updateTodo)
    			this.pubId = pubsub.subscribe('deleteTodo',this.deleteTodo)
    		},
    		beforeDestroy(){
    			this.$bus.$off('checkTodo')
    			this.$bus.$off('updateTodo')
    			pubsub.unsubscribe(this.pubId)
    		}
    	}
    </script>
    
    • 准备编辑
      在这里插入图片描述
    • 正在编辑(按钮不显示)
      在这里插入图片描述
    • 焦点移除,修改
      在这里插入图片描述

⭐️内容不为空限制

// 失去焦点回调(真正执行修改)
handleBlur(fasong,e){
    fasong.isEdit = false
    if(!e.target.value.trim()) return alert('输入不能为空')
    this.$bus.$emit('updateTodo',fasong.id,e.target.value)
}

在这里插入图片描述

⭐️点击编辑按钮自动获取焦点

this.$nextTick(function(){
   this.$refs.inputTitle.focus()
})
  • 🔥 nextTick
    • 语法:this.$nextTick(回调函数)
    • 作用:在下一次 DOM 更新结束后执行其指定的回调。
    • 什么时候用:当改变数据后,要基于更新后的新DOM进行某些操作时,要在nextTick所指定的回调函数中执行。

📚Vue封装的过度与动画

🐇使用方法

  1. 作用:在插入、更新或移除 DOM元素时,在合适的时候给元素添加样式类名。
  2. 写法
    • 准备好样式

      • 元素进入的样式:
        • v-enter:进入的起点
        • v-enter-active:进入过程中
        • v-enter-to:进入的终点
      • 元素离开的样式:
        • v-leave:离开的起点
        • v-leave-active:离开过程中
        • v-leave-to:离开的终点
          在这里插入图片描述
    • 使用<transition>包裹要过度的元素,并配置name属性:

      <transition name="hello">
      	<h1 v-show="isShow">你好啊!</h1>
      </transition>
      
    • 备注:若有多个元素需要过度,则需要使用:<transition-group>,且每个元素都要指定key值。

🐇案例练习

  • 过度效果

    <template>
    	<div>
    		<button @click="isShow = !isShow">显示/隐藏</button>
    		<transition name="hello" appear>
    			<h1 v-show="isShow">你好啊!</h1>
    		</transition>
    	</div>
    </template>
    
    <script>
    	export default {
    		name:'Final-Test',
    		data() {
    			return {
    				isShow:true
    			}
    		},
    	}
    </script>
    
    <style scoped>
    	h1{
    		background-color: pink;
    	}
    
    	.hello-enter-active{
    		animation: atguigu 0.5s linear;
    	}
    
    	.hello-leave-active{
    		animation: atguigu 0.5s linear reverse;
    	}
    
    	@keyframes atguigu {
    		from{
    			transform: translateX(-100%);
    		}
    		to{
    			transform: translateX(0px);
    		}
    	}
    </style>
    
  • 多个元素过度

    <template>
    	<div>
    		<button @click="isShow = !isShow">显示/隐藏</button>
    		<transition-group name="hello" appear>
    			<h1 v-show="!isShow" key="1">你好啊!</h1>
    			<h1 v-show="isShow" key="2">尚硅谷!</h1>
    		</transition-group>
    	</div>
    </template>
    
    <script>
    	export default {
    		name:'Final-Test2',
    		data() {
    			return {
    				isShow:true
    			}
    		},
    	}
    </script>
    
    <style scoped>
    	h1{
    		background-color: skyblue;
    	}
    	/* 进入的起点、离开的终点 */
    	.hello-enter,.hello-leave-to{
    		transform: translateX(-100%);
    	}
    	.hello-enter-active,.hello-leave-active{
    		transition: 0.5s linear;
    	}
    	/* 进入的终点、离开的起点 */
    	.hello-enter-to,.hello-leave{
    		transform: translateX(0);
    	}
    </style>
    
  • 集成第三方动画,animate.css官网

    <template>
    	<div>
    		<button @click="isShow = !isShow">显示/隐藏</button>
    		<transition-group 
    			appear
    			name="animate__animated animate__bounce" 
    			enter-active-class="animate__swing"
    			leave-active-class="animate__backOutUp"
    		>
    			<h1 v-show="!isShow" key="1">你好啊!</h1>
    			<h1 v-show="isShow" key="2">尚硅谷!</h1>
    		</transition-group>
    	</div>
    </template>
    
    <script>
    	// npm install animate.css
    	import 'animate.css'
    	export default {
    		name:'Final-Test3',
    		data() {
    			return {
    				isShow:true
    			}
    		},
    	}
    </script>
    
    <style scoped>
    	h1{
    		background-color: rgb(0, 255, 183);
    	}
    </style>
    

在这里插入图片描述

🐇TodoList案例优化

  • 让每一个todo的添加和删除都很柔和
    • 法①:UserItem.vue的整个li加过度和动画
    • 法②:在UserList.vue添加(关注多组是transition-group)(以下代码实现方式)
  • 结构部分
    <template>
        <ul class="todo-main">
            <transition-group name="todo" appear>
                <UserItem 
                    v-for="todoObj in todos" 
                    :key="todoObj.id" 
                    :fasong="todoObj" 
                ></UserItem>
            </transition-group>
        </ul>
    </template>
    
  • 样式部分
    .todo-enter-active{
        animation: atguigu 0.5s linear;
     }
    
     .todo-leave-active{
         animation: atguigu 0.5s linear reverse;
     }
    
     @keyframes atguigu {
         from{
             transform: translateX(100%);
         }
         to{
             transform: translateX(0px);
         }
     }
    

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

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

相关文章

error Error: certificate has expired

解决方案&#xff1a; yarn config set "strict-ssl" false -g 我开发的chatgpt网站&#xff1a; https://chat.xutongbao.top

npm run serve启动报错npm ERR! Missing script: “serve“

启动项目的时候用npm run serve发现报了以下的错误 解决方法&#xff1a; 1.一般情况下&#xff0c;这个问题是因为package.json文件里面确实没有 这里没有可能因为你的脚手架版本比较低&#xff0c;如果不想换&#xff0c;可以用 这里面有的 npm run dev去启动也是可以的 n…

centos 9 编译安装 LAMP wordpress

[rootlocalhost ~]# ll 总用量 655760 -rw-------. 1 root root 1040 2月 17 16:57 anaconda-ks.cfg drwxr-xr-x. 29 501 games 4096 2月 21 11:00 apr-1.7.4 -rw-r--r--. 1 root root 1122147 2月 21 10:57 apr-1.7.4.tar.gz drwxr-xr-x. 21 501 games …

微前端(qiankun,webpack5模块联邦)

1singleSpa vue 出现这个错误是因为 node.js V17版本中最近发布的OpenSSL3.0, 而OpenSSL3.0对允许算法和密钥大小增加了严格的限制&#xff0c;可能会对生态系统造成一些影响. 临时方案 export NODE_OPTIONS--openssl-legacy-provider 总结 子应用 子应用独立运行 判断是…

嵌入式系统在智慧城市建设中的关键角色与挑战

&#xff08;本文为简单介绍&#xff0c;观点源于网络&#xff09; 智慧城市的概念&#xff0c;随着信息技术的日益发展而不断深化。它利用各种信息传感器&#xff0c;通过物联网、云计算、大数据等技术手段&#xff0c;实现城市管理的智能化、精细化。在这一过程中&#xff0…

【C#】List泛型数据集如何循环移动,最后一位移动到第一位,以此类推

欢迎来到《小5讲堂》 大家好&#xff0c;我是全栈小5。 这是《C#》系列文章&#xff0c;每篇文章将以博主理解的角度展开讲解&#xff0c; 特别是针对知识点的概念进行叙说&#xff0c;大部分文章将会对这些概念进行实际例子验证&#xff0c;以此达到加深对知识点的理解和掌握。…

微服务篇之负载均衡

一、Ribbon负载均衡流程 二、Ribbon负载均衡策略 1. RoundRobinRule&#xff1a;简单轮询服务列表来选择服务器。 2. WeightedResponseTimeRule&#xff1a;按照权重来选择服务器&#xff0c;响应时间越长&#xff0c;权重越小。 3. RandomRule&#xff1a;随机选择一个可用的服…

线性代数:向量组的秩

目录 回顾“秩” 及 向量组线性表示 相关特性 向量组的秩 例1 例2 矩阵的“秩” 及 向量组线性表示 相关特性 向量组的秩 例1 例2

前端知识复习

1.symbol类型 Symbol 是 ECMAScript 6 中引入的一种新的基本数据类型&#xff0c;它表示独一无二的值。Symbol 值是通过 Symbol() 函数创建的。 Symbol 值具有以下特点&#xff1a; 独一无二性&#xff08;唯一性&#xff09;&#xff1a;每个通过 Symbol() 函数创建的 Symb…

VBA技术资料MF121:使用多个分隔符拆分字符串

我给VBA的定义&#xff1a;VBA是个人小型自动化处理的有效工具。利用好了&#xff0c;可以大大提高自己的工作效率&#xff0c;而且可以提高数据的准确度。“VBA语言専攻”提供的教程一共九套&#xff0c;分为初级、中级、高级三大部分&#xff0c;教程是对VBA的系统讲解&#…

LocalSend跨设备传输文件传输协议 v2

LocalSend仓库地址&#xff1a;GitHub - localsend/localsend: An open-source cross-platform alternative to AirDrop LocalSend 协议 v2 English | 简体中文 主要为了实现一个不依赖于任何外部服务器的简单 REST 协议。 因为计算机网络比较复杂&#xff0c;因此我们不能假…

欢迎来到 《探索HarmonyOS(鸿蒙应用开发)入门到实战》专栏!

各位小伙伴 国产纯血鸿蒙系统来了。 了解鸿蒙技术的小伙伴都知道,鸿蒙技术一直在持续更新,越来越多的鸿蒙开发者都开始投入鸿蒙技术的开发。 为了更容易和快速的入手鸿蒙开发,闪客专门做了一个鸿蒙应用开发入门到实战课程。 热情的开发者们,是否已经准备好加入革命性的物…

【vue3】手动实现md在线编辑

1.背景 由于知识库的一些.md格式的文件的文件内容可能会有变动&#xff0c;如果频繁下载修改后&#xff0c;再进行上传&#xff0c;会让用户操作不方便&#xff0c;为此接入md在线编辑功能 2 md在线编辑具体实现 2.1 搭建项目 搭建项目下载和引入bytemd和fflate相关依赖&…

ansible及其模块

一、ansible是什么&#xff1f; Ansible是一个基于Python开发的配置管理和应用部署工具&#xff0c;现在也在自动化管理领域大放异彩。它融合了众多老牌运维工具的优点&#xff0c;Pubbet和Saltstack能实现的功能&#xff0c;Ansible基本上都可以实现。 Ansible能批量配置、部…

第十七届“挑战杯”广东大学生课外学术科技作品比赛感想

博主曾在2023年参加了第十七届“挑战杯”广东大学生课外学术科技作品比赛&#xff0c;也就是人们俗称的大挑&#xff0c;在团队赛里面含金量应该是排在第一档的了&#xff0c;当初我们有幸作为学校唯一一支科技创新B类进入到线下答辩&#xff0c;线下答辩就是区分银奖和金奖和特…

不同种类遥感图像汇总 !!

文章目录 前言 1、可见光遥感图像 2、全色遥感图像 3、多光谱遥感图像 4、高光谱遥感图像 5、红外遥感图像 6、激光雷达图像 7、合成孔径雷达遥感图像 前言 遥感技术是从远距离感知目标反射或自身辐射的电磁波、可见光、红外线&#xff0c;对目标进行探测和识别的技术。遥感卫…

HTML学习笔记——08:表单<form>

HTML <form> 元素表示文档中的一个区域&#xff0c;此区域包含交互控件&#xff0c;用于向 Web 服务器提交信息。 例如&#xff1a;登录页面。 作用&#xff1a;搜集不同类型的用户输入&#xff0c;并向服务器传送数据。 注意&#xff1a;表单本身并不可见&#xff01;…

《Linux C编程实战》笔记:消息队列

消息队列是一个存放在内核中的消息链表&#xff0c;每个消息队列由消息队列标识符标识。与管道不同的是消息队列存放在内核中&#xff0c;只有在内核重启&#xff08;即操作系统重启&#xff09;或显示地删除一个消息队列时&#xff0c;该消息队列才会被真正的删除。 操作消息…

前端进度条组件NProgress

nprogress 安装 npm install --save nprogress使用 import NProgress from nprogress // 引入nprogress插件 import nprogress/nprogress.css // 这个nprogress样式必须引入// axios请求拦截器 axios.interceptors.request.use(config > {NProgress.start() // 设置加载进…

二维码扫码登录原理,其实比你想的要简单的多

二维码&#xff0c;大家再熟悉不过了 购物扫个码&#xff0c;吃饭扫个码&#xff0c;坐公交也扫个码 在扫码的过程中&#xff0c;大家可能会有疑问&#xff1a;这二维码安全吗&#xff1f; 会不会泄漏我的个人信息&#xff1f; 更深度的用户还会考虑&#xff1a;我的系统是不…