【Vue】Vue2(13)

文章目录

  • 1 编程式路由导航
    • 1.1 Message.vue
    • 1.2 Banner.vue
  • 2 缓存路由组件
    • 2.1 Home.vue
  • 3 两个新的生命周期钩子
    • 3.1 News.vue
  • 4 路由守卫
    • 4.1 全局路由守卫
      • 4.1.1 index.js
    • 4.2 独享路由守卫
      • 4.2.1 index.js
    • 4.3 组件内路由守卫
      • 4.3.1 About.vue
  • 5 路由器的两种工作模式
    • 5.1 项目打包与部署
    • 5.2 nodejs中的server.js
  • 6 Vue UI 组件库
    • 6.1 移动端常用 UI 组件库
    • 6.2 PC 端常用 UI 组件库
    • 6.3 element-ui组件库
      • 6.3.1 完整引入
      • 6.3.2 局部引入
      • 6.3.3 main.js
      • 6.3.4 App.vue

1 编程式路由导航

  • 作用:不借助<router-link>实现路由跳转,让路由跳转更加灵活。

  • 具体编码:

    //$router的两个API
    this.$router.push({
    	name:'xiangqing',
    	params:{
    		id:xxx,
    		title:xxx
    	}
    })
    
    this.$router.replace({
    	name:'xiangqing',
    	params:{
    		id:xxx,
    		title:xxx
    	}
    })
    this.$router.forward() //前进
    this.$router.back() //后退
    this.$router.go() //可前进也可后退
    

1.1 Message.vue

<template>
	<div>
		<ul>
			<li v-for="m in messageList" :key="m.id">
				<!-- 跳转路由并携带params参数,to的字符串写法 -->
				<!-- <router-link :to="`/home/message/detail/${m.id}/${m.title}`">{{m.title}}</router-link>&nbsp;&nbsp; -->

				<!-- 跳转路由并携带params参数,to的对象写法 -->
				<router-link :to="{
					name:'xiangqing',
					query:{
						id:m.id,
						title:m.title
					}
				}">
					{{m.title}}
				</router-link>
				<button @click="pushShow(m)">push查看</button>
				<button @click="replaceShow(m)">replace查看</button>
			</li>
		</ul>
		<hr>
		<router-view></router-view>
	</div>
</template>

<script>
	export default {
		name:'Message',
		data() {
			return {
				messageList:[
					{id:'001',title:'消息001'},
					{id:'002',title:'消息002'},
					{id:'003',title:'消息003'}
				]
			}
		},
		methods: {
			pushShow(m){
				this.$router.push({
					name:'xiangqing',
					query:{
						id:m.id,
						title:m.title
					}
				})
			},
			replaceShow(m){
				this.$router.replace({
					name:'xiangqing',
					query:{
						id:m.id,
						title:m.title
					}
				})
			}
		},
	}
</script>

1.2 Banner.vue

<template>
	<div class="col-xs-offset-2 col-xs-8">
		<div class="page-header">
			<h2>Vue Router Demo</h2>
			<button @click="back">后退</button>
			<button @click="forward">前进</button>
			<button @click="test">测试一下go</button>
		</div>
	</div>
</template>

<script>
	export default {
		name:'Banner',
		methods: {
			back(){
				this.$router.back()
				// console.log(this.$router)
			},
			forward(){
				this.$router.forward()
			},
			test(){
				this.$router.go(3) // 正数:连续前进,负数:连续后退
			}
		},
	}
</script>

2 缓存路由组件

  • 作用:让不展示的路由组件保持挂载,不被销毁。

  • 具体编码:

    <keep-alive include="News"> 
        <router-view></router-view>
    </keep-alive>
    

2.1 Home.vue

<template>
	<div>
		<h2>Home组件内容</h2>
		<div>
			<ul class="nav nav-tabs">
				<li>
					<router-link class="list-group-item" active-class="active" to="/home/news">News</router-link>
				</li>
				<li>
					<router-link class="list-group-item" active-class="active" to="/home/message">Message</router-link>
				</li>
			</ul>
			<!-- 缓存多个路由组件 -->
			<!-- <keep-alive :include="['News','Message']"> -->
				
			<!-- 缓存一个路由组件 -->
			<keep-alive include="News"><!-- include=组件名 -->
				<router-view></router-view>
			</keep-alive>
		</div>
	</div>
</template>

<script>
	export default {
		name:'Home',
		/* beforeDestroy() {
			console.log('Home组件即将被销毁了')
		}, */
		/* mounted() {
			console.log('Home组件挂载完毕了',this)
			window.homeRoute = this.$route
			window.homeRouter = this.$router
		},  */
	}
</script>

3 两个新的生命周期钩子

  • 作用:路由组件所独有的两个钩子,用于捕获路由组件的激活状态。
  • 具体名字:
    1. activated路由组件被激活时触发。
    2. deactivated路由组件失活时触发。

3.1 News.vue

<template>
	<ul>
		<li :style="{opacity}">欢迎学习Vue</li>
		<li>news001 <input type="text"></li>
		<li>news002 <input type="text"></li>
		<li>news003 <input type="text"></li>
	</ul>
</template>

<script>
	export default {
		name:'News',
		data() {
			return {
				opacity:1
			}
		},
		/* beforeDestroy() {
			console.log('News组件即将被销毁了')
			clearInterval(this.timer)
		}, */
		/* mounted(){
			this.timer = setInterval(() => {
				console.log('@')
				this.opacity -= 0.01
				if(this.opacity <= 0) this.opacity = 1
			},16)
		}, */
		activated() { // 从没有出现在你面前到出现在你面前,activated激活
			console.log('News组件被激活了')
			this.timer = setInterval(() => {
				console.log('@')
				this.opacity -= 0.01
				if(this.opacity <= 0) this.opacity = 1
			},16)
		},
		deactivated() { // 不想看该组件了,将该组件切走时,deactivated失活
			console.log('News组件失活了')
			clearInterval(this.timer)
		},
	}
</script>

4 路由守卫

  • 作用:对路由进行权限控制。

  • 分类:全局守卫、独享守卫、组件内守卫。

  • 全局守卫:

    //全局前置守卫:初始化时执行、每次路由切换前执行
    router.beforeEach((to,from,next)=>{
    	console.log('beforeEach',to,from)
    	if(to.meta.isAuth){ //判断当前路由是否需要进行权限控制
    		if(localStorage.getItem('school') === 'atguigu'){ //权限控制的具体规则
    			next() //放行
    		}else{
    			alert('暂无权限查看')
    			// next({name:'guanyu'})
    		}
    	}else{
    		next() //放行
    	}
    })
    
    //全局后置守卫:初始化时执行、每次路由切换后执行
    router.afterEach((to,from)=>{
    	console.log('afterEach',to,from)
    	if(to.meta.title){ 
    		document.title = to.meta.title //修改网页的title
    	}else{
    		document.title = 'vue_test'
    	}
    })
    
  • 独享守卫:

    beforeEnter(to,from,next){
    	console.log('beforeEnter',to,from)
    	if(to.meta.isAuth){ //判断当前路由是否需要进行权限控制
    		if(localStorage.getItem('school') === 'atguigu'){
    			next()
    		}else{
    			alert('暂无权限查看')
    			// next({name:'guanyu'})
    		}
    	}else{
    		next()
    	}
    }
    
  • 组件内守卫:

    //进入守卫:通过路由规则,进入该组件时被调用
    beforeRouteEnter (to, from, next) {
    },
    //离开守卫:通过路由规则,离开该组件时被调用
    beforeRouteLeave (to, from, next) {
    }
    

4.1 全局路由守卫

4.1.1 index.js

// 该文件专门用于创建整个应用的路由器
import VueRouter from 'vue-router'
//引入组件
import About from '../pages/About'
import Home from '../pages/Home'
import News from '../pages/News'
import Message from '../pages/Message'
import Detail from '../pages/Detail'

//创建并暴露一个路由器
const router =  new VueRouter({
	routes:[
		{
			name:'guanyu',
			path:'/about',
			component:About,
			meta:{title:'关于'}
		},
		{
			name:'zhuye',
			path:'/home',
			component:Home,
			meta:{title:'主页'},
			children:[
				{
					name:'xinwen',
					path:'news',
					component:News,
					meta:{isAuth:true,title:'新闻'}
				},
				{
					name:'xiaoxi',
					path:'message',
					component:Message,
					meta:{isAuth:true,title:'消息'},
					children:[
						{
							name:'xiangqing',
							path:'detail',
							component:Detail,
							meta:{isAuth:true,title:'详情'},

							//props的第一种写法,值为对象,该对象中的所有key-value都会以props的形式传给Detail组件。
							// props:{a:1,b:'hello'}

							//props的第二种写法,值为布尔值,若布尔值为真,就会把该路由组件收到的所有params参数,以props的形式传给Detail组件。
							// props:true

							//props的第三种写法,值为函数
							props($route){
								return {
									id:$route.query.id,
									title:$route.query.title,
									a:1,
									b:'hello'
								}
							}

						}
					]
				}
			]
		}
	]
})

//全局前置路由守卫————初始化的时候被调用、每次路由切换之前被调用
router.beforeEach((to,from,next)=>{
	console.log('前置路由守卫',to,from)
	// meta:路由元信息,自定义的信息
	if(to.meta.isAuth){ //判断是否需要鉴权 // to.path / to.name
		if(localStorage.getItem('school')==='atguigu'){
			next()
		}else{
			alert('学校名不对,无权限查看!')
		}
	}else{
		next()
	}
})

//全局后置路由守卫————初始化的时候被调用、每次路由切换之后被调用
router.afterEach((to,from)=>{
	console.log('后置路由守卫',to,from)
	document.title = to.meta.title || '硅谷系统'
})

export default router

4.2 独享路由守卫

4.2.1 index.js

// 该文件专门用于创建整个应用的路由器
import VueRouter from 'vue-router'
//引入组件
import About from '../pages/About'
import Home from '../pages/Home'
import News from '../pages/News'
import Message from '../pages/Message'
import Detail from '../pages/Detail'

//创建并暴露一个路由器
const router =  new VueRouter({
	routes:[
		{
			name:'guanyu',
			path:'/about',
			component:About,
			meta:{title:'关于'}
		},
		{
			name:'zhuye',
			path:'/home',
			component:Home,
			meta:{title:'主页'},
			children:[
				{
					name:'xinwen',
					path:'news',
					component:News,
					meta:{isAuth:true,title:'新闻'},
					beforeEnter: (to, from, next) => {
						console.log('独享路由守卫',to,from)
						if(to.meta.isAuth){ //判断是否需要鉴权
							if(localStorage.getItem('school')==='atguigu'){
								next()
							}else{
								alert('学校名不对,无权限查看!')
							}
						}else{
							next()
						}
					}
				},
				{
					name:'xiaoxi',
					path:'message',
					component:Message,
					meta:{isAuth:true,title:'消息'},
					children:[
						{
							name:'xiangqing',
							path:'detail',
							component:Detail,
							meta:{isAuth:true,title:'详情'},

							//props的第一种写法,值为对象,该对象中的所有key-value都会以props的形式传给Detail组件。
							// props:{a:1,b:'hello'}

							//props的第二种写法,值为布尔值,若布尔值为真,就会把该路由组件收到的所有params参数,以props的形式传给Detail组件。
							// props:true

							//props的第三种写法,值为函数
							props($route){
								return {
									id:$route.query.id,
									title:$route.query.title,
									a:1,
									b:'hello'
								}
							}

						}
					]
				}
			]
		}
	]
})

//全局前置路由守卫————初始化的时候被调用、每次路由切换之前被调用
/* router.beforeEach((to,from,next)=>{
	console.log('前置路由守卫',to,from)
	if(to.meta.isAuth){ //判断是否需要鉴权
		if(localStorage.getItem('school')==='atguigu'){
			next()
		}else{
			alert('学校名不对,无权限查看!')
		}
	}else{
		next()
	}
}) */

//全局后置路由守卫————初始化的时候被调用、每次路由切换之后被调用
router.afterEach((to,from)=>{
	console.log('后置路由守卫',to,from)
	document.title = to.meta.title || '硅谷系统'
})

export default router

4.3 组件内路由守卫

4.3.1 About.vue

<template>
	<h2>我是About的内容</h2>
</template>

<script>
	export default {
		name:'About',
		/* beforeDestroy() {
			console.log('About组件即将被销毁了')
		},*/
		/* mounted() {
			console.log('About组件挂载完毕了',this)
			window.aboutRoute = this.$route
			window.aboutRouter = this.$router
		},  */
		mounted() {
			// console.log('%%%',this.$route)
		},

		//通过路由规则,进入该组件时被调用
		beforeRouteEnter (to, from, next) {
			console.log('About--beforeRouteEnter',to,from)
			if(to.meta.isAuth){ //判断是否需要鉴权
				if(localStorage.getItem('school')==='atguigu'){
					next()
				}else{
					alert('学校名不对,无权限查看!')
				}
			}else{
				next()
			}
		},

		//通过路由规则,离开该组件时被调用
		beforeRouteLeave (to, from, next) {
			console.log('About--beforeRouteLeave',to,from)
			next()
		}
	}
</script>

5 路由器的两种工作模式

  • 对于一个url来说,什么是hash值?—— #及其后面的内容就是hash值。
  • hash值不会包含在 HTTP 请求中,即:hash值不会带给服务器。
  • hash模式:
  • 地址中永远带着#号,不美观 。
  • 若以后将地址通过第三方手机app分享,若app校验严格,则地址会被标记为不合法。
  • 兼容性较好。
  • history模式:
  • 地址干净,美观 。
  • 兼容性和hash模式相比略差。
  • 应用部署上线时需要后端人员支持,解决刷新页面服务端404的问题。

5.1 项目打包与部署

  • npm run build,将项目打包,此时.vue文件转为浏览器能解析的.js、.css等文件。
  • nodejs创建一个小型服务器,将打包好的文件在上面部署。
  • 如果路由器的工作模式是"history",刷新页面时会出现404错误。
  • 解决404问题:服务器中的中间件:connect-history-api-fallback。
  • npm i connect-history-api-fallback安装,nodejs中添加代码:const history = require('connect-history-api-fallback');(静态资源前使用)。

5.2 nodejs中的server.js

const express = require('express');
const history = require('connect-history-api-fallback');
const app = express();
app.use(express.static( dirname+'/static'));

app.get('/person',(req,res)=>{
	res.send({
		name:"tom',
		age:18
	})
})

app.listen(5005,(err)=>{
	if(!err)console.log("服务器启动成功了!');
})

6 Vue UI 组件库

6.1 移动端常用 UI 组件库

  • Vant:https://youzan.github.io/vant
  • Cube UI:https://didi.github.io/cube-ui
  • Mint UI:http://mint-ui.github.io

6.2 PC 端常用 UI 组件库

  • Element UI:https://element.eleme.cn
  • IView UI:https://www.iviewui.com

6.3 element-ui组件库

6.3.1 完整引入

  • 安装:npm i element-ui
  • 文件中引入:
    //引入ElementUI组件库
    import ElementUI from 'element-ui';
    //引入ElementUI全部样式
    import 'element-ui/lib/theme-chalk/index.css';
    //应用ElementUI
    Vue.use(ElementUI);
    

6.3.2 局部引入

  • 安装:npm install babel-plugin-component -D

  • 修改babel.config.js文件:

    module.exports = {
      presets: [
        '@vue/cli-plugin-babel/preset',
    		["@babel/preset-env", { "modules": false }],
      ],
    	plugins:[
        [
          "component",
          {
            "libraryName": "element-ui",
            "styleLibraryName": "theme-chalk"
          }
        ]
      ]
    }
    
  • 文件中引入:

    //按需引入
    import { Button,Row,DatePicker } from 'element-ui';
    Vue.component('atguigu-button', Button);
    Vue.component('atguigu-row', Row);
    Vue.component('atguigu-date-picker', DatePicker);
    

6.3.3 main.js

//引入Vue
import Vue from 'vue'
//引入App
import App from './App.vue'

//完整引入
//引入ElementUI组件库
// import ElementUI from 'element-ui';
//引入ElementUI全部样式
// import 'element-ui/lib/theme-chalk/index.css';

//按需引入
import { Button,Row,DatePicker } from 'element-ui';

//关闭Vue的生产提示
Vue.config.productionTip = false

//应用ElementUI
// Vue.use(ElementUI);
Vue.component('atguigu-button', Button);
Vue.component('atguigu-row', Row);
Vue.component('atguigu-date-picker', DatePicker);

//创建vm
new Vue({
	el:'#app',
	render: h => h(App),
})

6.3.4 App.vue

<template>
  <div>
		<button>原生的按钮</button>
		<input type="text">
		<atguigu-row>
			<el-button>默认按钮</el-button>
			<el-button type="primary">主要按钮</el-button>
			<el-button type="success">成功按钮</el-button>
			<el-button type="info">信息按钮</el-button>
			<el-button type="warning">警告按钮</el-button>
			<el-button type="danger">危险按钮</el-button>
		</atguigu-row>
		<atguigu-date-picker
      type="date"
      placeholder="选择日期">
    </atguigu-date-picker>
		<atguigu-row>
			<el-button icon="el-icon-search" circle></el-button>
			<el-button type="primary" icon="el-icon-s-check" circle></el-button>
			<el-button type="success" icon="el-icon-check" circle></el-button>
			<el-button type="info" icon="el-icon-message" circle></el-button>
			<el-button type="warning" icon="el-icon-star-off" circle></el-button>
			<el-button type="danger" icon="el-icon-delete" circle></el-button>
		</atguigu-row>
  </div>
</template>

<script>
	export default {
		name:'App',
	}
</script>

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

flv格式如何转换mp4?将flv转换成MP4格式的9种转换方法

flv格式如何转换mp4&#xff1f;在进行flv转MP4的转换之前&#xff0c;了解两种格式的基本特点和差异也是至关重要的。flv格式以其流媒体传输的高效性和对Flash Player的依赖而闻名&#xff0c;而MP4则以其广泛的兼容性、高质量的音视频同步以及灵活的编码选项而著称。通过对比…

vue mixins使用示例

混入 (mixins)&#xff1a; 是一种分发 Vue 组件中可以复用功能灵活的方式。混入对象可以包含任意组件的选项。当组件使用混入对象的时候&#xff0c;所有混入对象的选项将被混入该组件本身的选项。 使用示例: 定义使用的mixins对象 export const HelloWorldMixin {data() {r…

Chromium 沙盒Sandbox源码介绍(3)

本篇主要说下沙箱的环境变量策略【Environment】&#xff1a; 一、环境变量&#xff1a; getEnvironmentStrings 函数返回指向内存块的指针&#xff0c;该内存块包含调用进程的环境变量 (系统和用户环境变量) getEnvironmentStrings 函数 (processenv.h) - Win32 apps | Mic…

ubuntu2204配置cuda

ubuntu2204配置cuda ✅系统版本&#xff1a;ubuntu22.04 LTS ✅显卡&#xff1a;英伟达2070S ✅CPU&#xff1a;i9 10900 ✅主板&#xff1a;戴尔品牌机 教程&#x1f4a8;&#x1f4a8;&#x1f4a8;&#x1f4a8;&#xff1a; ps&#xff1a;本人按照该方法一遍成功&#…

EasyX:初始化绘图窗口initgraph() 的使用

前言 学习使用EasyX图形库的initgraph窗口函数。 一、创建新项目 二、创建C空项目 三、找个地方存一下&#xff0c;创建 四、如果左边的框框找不到 五、点视图&#xff0c;然后点解决方案管理器&#xff0c;左边的框框就出来了 六、源文件添加新建项 七、给文件取个名&#x…

qt QPushButton详解

QPushButton是Qt Widgets模块中的一个基本控件&#xff0c;用于提供可点击的按钮。它是用户界面中最为常见和常用的控件之一&#xff0c;通过点击按钮&#xff0c;用户可以触发特定的应用程序操作。 重要方法 QPushButton(const QIcon &icon, const QString &text, QWi…

数据通信与网络课程展示图谱问答展示系统

&#x1f4a1; 你是否在学习“数据通信与网络”时感觉知识点分散&#xff0c;难以整理&#xff1f;学了后面忘记前面&#xff0c;知识点的关联也难以梳理&#xff1f;别担心&#xff01;我们公司推出的【数据通信与网络课程展示图谱问答系统】帮你一次性解决所有问题&#xff0…

手撕反向传播

关于二分类的交叉熵损失部分数学推导过程。 有些地方加以注释&#xff0c;公式太多懒得MD格式了 #%% import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn import datasetsiris_data datasets.load_iris() in_put_data iris_data.data corr…

Golang | Leetcode Golang题解之第494题目标和

题目&#xff1a; 题解&#xff1a; func findTargetSumWays(nums []int, target int) int {sum : 0for _, v : range nums {sum v}diff : sum - targetif diff < 0 || diff%2 1 {return 0}neg : diff / 2dp : make([]int, neg1)dp[0] 1for _, num : range nums {for j …

【嵌入式Linux】Linux设备树详解

设备树是是Linux中一种用于描述硬件配置的数据结构&#xff0c;它在系统启动时提供给内核&#xff0c;以便内核能够识别和配置硬件资源。设备树在嵌入式Linux系统中尤其重要&#xff0c;因为这些系统通常不具备标准的硬件配置&#xff0c;需要根据实际的硬件配置来动态配置内核…

JMeter之mqtt-jmeter 插件介绍

前言 mqtt-jmeter插件是JMeter中的一个第三方插件&#xff0c;用于支持MQTT&#xff08;Message Queuing Telemetry Transport&#xff09;协议的性能测试。MQTT是一种轻量级的发布/订阅消息传输协议&#xff0c;广泛应用于物联网和传感器网络中。 一、安装插件 mqtt-jmeter项目…

Java项目-基于springboot框架的时间管理系统项目实战(附源码+文档)

作者&#xff1a;计算机学长阿伟 开发技术&#xff1a;SpringBoot、SSM、Vue、MySQL、ElementUI等&#xff0c;“文末源码”。 开发运行环境 开发语言&#xff1a;Java数据库&#xff1a;MySQL技术&#xff1a;SpringBoot、Vue、Mybaits Plus、ELementUI工具&#xff1a;IDEA/…

数据抓取时,使用动态IP要注意哪些?

在充满竞争和数据驱动的商业环境中&#xff0c;动态IP已成为数据抓取过程中不可或缺的工具。动态IP的应用能有效提高抓取成功率&#xff0c;但同时也伴随着一系列需要注意的问题。在本文中&#xff0c;我们将详细探讨在数据抓取时使用动态IP时应注意的事项&#xff0c;以确保抓…

git-合并连续两次提交(一个功能,备注相同)

前言&#xff1a; 场景是这样&#xff0c;由于我是实现一个功能&#xff0c;先进行了一次commit,然后我发现写的有些小问题&#xff0c;优化了一下功能并且把代码优化了一次&#xff0c;于是又提交了一次。两次的提交都是以相同的备注&#xff08;当然这个无所谓&#xff09;&a…

【设计模式系列】简单工厂模式

一、什么是简单工厂模式 简单工厂模式&#xff08;Simple Factory Pattern&#xff09;是一种设计模式&#xff0c;其中包含一个工厂类&#xff0c;根据传入的参数不同&#xff0c;返回不同类的实例。这个工厂类封装了对象的创建逻辑&#xff0c;使得客户端代码可以从直接创建…

CSDN Markdown 编辑器语法大全

Markdown 是一种轻量级标记语言&#xff0c;它以简洁、易读易写的特点&#xff0c;被广泛应用于技术文档、博客文章、笔记等领域。CSDN 的 Markdown 编辑器为用户提供了丰富的功能&#xff0c;让用户能够轻松地创建格式规范、内容丰富的文档。以下是一份详细的 CSDN Markdown 编…

Python 应用可观测重磅上线:解决 LLM 应用落地的“最后一公里”问题

作者&#xff1a;彦鸿 背景 随着 LLM&#xff08;大语言模型&#xff09;技术的不断成熟和应用场景的不断拓展&#xff0c;越来越多的企业开始将 LLM 技术纳入自己的产品和服务中。LLM 在自然语言处理方面表现出令人印象深刻的能力。然而&#xff0c;其内部机制仍然不明确&am…

本地大模型部署和基于RAG方案的私有知识库搭建

背景与目的 在人工智能领域&#xff0c;大语言模型如GPT系列、BERT等&#xff0c;以其强大的语言生成与理解能力&#xff0c;正在深刻改变着我们的工作与生活方式。这些模型通过海量数据训练而成&#xff0c;能够执行从文本生成、问答系统到代码编写等多种任务。然而&#xff…

目标检测——yolov5-3.1的环境搭建和运行

第一步&#xff1a;安装anaconda环境&#xff0c;并且配置好cuda&#xff0c;安装需要的基本包 查看对应cuda版本&#xff0c;后续下载cudatoolkit需要对应版本 nvcc -V 第二步&#xff1a;创建虚拟环境&#xff0c;激活环境&#xff0c;安装所需的包 conda create -n yolo…

V2X介绍

文章目录 什么是V2XV2X的发展史早期的DSRC后起之秀C-V2XC-V2X 和DSRC 两者的对比 什么是V2X 所谓V2X&#xff0c;与流行的B2B、B2C如出一辙&#xff0c;意为vehicle to everything&#xff0c;即车对外界的信息交换。车联网通过整合全球定位系统&#xff08;GPS&#xff09;导…