当前位置: 首页 > news >正文

Vue2基础九、路由

零、文章目录

Vue2基础九、路由

1、单页应用

(1)单页应用是什么

  • 单页面应用(SPA:Single Page Application): 所有功能在 一个html页面 上实现
  • 具体示例: 网易云音乐 https://music.163.com/

(2)单页面应用VS多页面应用

image-20230714163332441

  • 单页面应用优缺点

    • 优点:按需更新性能高,开发效率高,用户体验好

    • 缺点:学习成本,首屏加载慢,不利于SEO

(3)单页面应用应用场景

  • 单页面应用应用场景:系统类网站 / 内部网站 / 文档类网站 /移动端站点
  • 多页面应用应用场景:公司官网 / 电商类网站

(4)单页应用优势原理

  • 单页面应用程序,之所以开发效率高,性能高,用户体验好,最大的原因就是:页面按需更新
  • 要按需更新,首先就需要明确:访问路径组件的对应关系!访问路径 和 组件的对应关系如何确定呢? 路由

2、路由概念

(1)路由是什么

  • 路由是一种映射关系

(2)Vue中路由

  • Vue中路由:路径组件 的 映射 关系

image-20230714170257903

3、基本使用

(1)简介

  • 目标:认识插件 VueRouter,掌握 VueRouter 的基本使用步骤
  • 作用:修改地址栏路径时,切换显示匹配的组件
  • 说明:Vue 官方的一个路由插件,是一个第三方包
  • 官网:https://v3.router.vuejs.org/zh/

(2)使用步骤

5个基础步骤 (固定)

  • ① 下载: 下载 VueRouter 模块到当前工程,版本3.6.5
yarn add vue-router@3.6.5
  • ② 引入
import VueRouter from 'vue-router' 
  • ③ 安装注册
Vue.use(VueRouter)
  • ④ 创建路由对象
const router = new VueRouter()
  • ⑤ 注入,将路由对象注入到new Vue实例中,建立关联
new Vue({
render: h => h(App),
router
}).$mount('#app')

2 个核心步骤

  • ① 创建需要的组件 (views目录),配置路由规则(路径组件的匹配关系 )

image-20230716212234471

  • ② 配置导航,配置路由出口(路径匹配的组件显示的位置)

image-20230716212311192

(3)代码实现

  • 父组件App.vue
<template><div><div class="footer_wrap"><a href="#/find">发现音乐</a><a href="#/my">我的音乐</a><a href="#/friend">朋友</a></div><div class="top"><!-- 路由出口 → 匹配的组件所展示的位置 --><router-view></router-view></div></div>
</template><script>
export default {};
</script><style>
body {margin: 0;padding: 0;
}
.footer_wrap {position: relative;left: 0;top: 0;display: flex;width: 100%;text-align: center;background-color: #333;color: #ccc;
}
.footer_wrap a {flex: 1;text-decoration: none;padding: 20px 0;line-height: 20px;background-color: #333;color: #ccc;border: 1px solid black;
}
.footer_wrap a:hover {background-color: #555;
}
</style>
  • 子组件Find.vue
<template><div><p>发现音乐</p><p>发现音乐</p><p>发现音乐</p><p>发现音乐</p></div>
</template><script>
export default {name: 'FindMusic'
}
</script><style></style>
  • 子组件Friend.vue
<template><div><p>我的朋友</p><p>我的朋友</p><p>我的朋友</p><p>我的朋友</p></div>
</template><script>
export default {name: 'MyFriend'
}
</script><style></style>
  • 子组件My.vue
<template><div><p>我的音乐</p><p>我的音乐</p><p>我的音乐</p><p>我的音乐</p></div>
</template><script>
export default {name: 'MyMusic'
}
</script><style></style>
  • 入口main.js中注册路由
import Vue from 'vue'
import App from './App.vue'// 路由的使用步骤 5 + 2
// 5个基础步骤
// 1. 下载 v3.6.5
// 2. 引入
// 3. 安装注册 Vue.use(Vue插件)
// 4. 创建路由对象
// 5. 注入到new Vue中,建立关联// 2个核心步骤
// 1. 建组件(views目录),配规则
// 2. 准备导航链接,配置路由出口(匹配的组件展示的位置) 
import Find from './views/Find'
import My from './views/My'
import Friend from './views/Friend'
import VueRouter from 'vue-router'
Vue.use(VueRouter) // VueRouter插件初始化const router = new VueRouter({// routes 路由规则们// route  一条路由规则 { path: 路径, component: 组件 }routes: [{ path: '/find', component: Find },{ path: '/my', component: My },{ path: '/friend', component: Friend },]
})Vue.config.productionTip = falsenew Vue({render: h => h(App),router
}).$mount('#app')

4、组件分类

(1)组件分类

  • 页面组件&复用组件

  • 都是 .vue文件 (本质无区别)

image-20230720204156487

(2)分类原因

分类开来 更易维护

  • src/views文件夹
    • 页面组件 - 页面展示 - 配合路由用
  • src/components文件夹
    • 复用组件 - 展示数据 - 常用于复用

(3)案例

  • 页面组件

image-20230720204254541

  • 复用组件

image-20230720204341997

5、路由模块封装

(1)路由封装好处

  • 问题:所有的路由配置都堆在main.js中合适么?
  • 目标:将路由模块抽离出来。
  • 好处:拆分模块,利于维护

(2)如何快速引入组件

  • @指代src目录,可以用于快速引入组件

(3)代码实现

  • 将路由部分放到router/index.js,main.js再引入这个文件,其他不变

image-20230720205549177

  • index.js
import Find from '@/views/Find'
import My from '@/views/My'
import Friend from '@/views/Friend'import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter) // VueRouter插件初始化// 创建了一个路由对象
const router = new VueRouter({// routes 路由规则们// route  一条路由规则 { path: 路径, component: 组件 }routes: [{ path: '/find', component: Find },{ path: '/my', component: My },{ path: '/friend', component: Friend },]
})export default router
  • main.js
import Vue from 'vue'
import App from './App.vue'
import router from './router/index'Vue.config.productionTip = falsenew Vue({render: h => h(App),router
}).$mount('#app')

6、声明式导航

(1)导航高亮

  • 需求:实现导航高亮效果

image-20230720210012234

  • vue-router 提供了一个全局组件 router-link (取代 a 标签)

    • 能跳转,配置 to 属性指定路径(必须) 。本质还是 a 标签 ,to 无需 #

    • 能高亮,默认就会提供高亮类名,可以直接设置高亮样式

image-20230720220955235

(2)精确匹配&模糊匹配

  • 我们发现 router-link 自动给当前导航添加了 两个高亮类名
  • ① router-link-active 模糊匹配 (用的多)
    • to=“/my” 可以匹配 /my /my/a /my/b …
  • ② router-link-exact-active 精确匹配
    • to=“/my” 仅可以匹配 /my

image-20230720221636818

(3)自定义高亮类名

  • router-link 的 两个高亮类名太长了,我们希望能定制怎么办?

image-20230720222556736

  • 可以在router/index.js文件中配置自定义样式类名
    • linkActiveClass 模糊匹配 类名自定义
    • linkExactActiveClass 精确匹配 类名自定义
const router = new VueRouter({routes: [...],linkActiveClass: "类名1",linkExactActiveClass: "类名2"
})

image-20230720222652098

(4)导航链接传参

  • 在跳转路由时, 进行传值,有两种方式

    • 查询参数传参

    • 动态路由传参

  • 查询参数传参

    • ① 语法:to=“/path?参数名=值
    • ② 对应页面组件接收传递过来的值:$route.query.参数名
  • 动态路由传参

    • ① 配置动态路由

    image-20230720223359337

    • ② 配置导航链接:to=“/path/参数值
    • ③ 对应页面组件接收传递过来的值:$route.params.参数名
  • 两种传参方式的区别

    • 查询参数传参 (比较适合传多个参数)

      • ① 跳转:to=“/path?参数名=值&参数名2=值”

      • ② 获取:$route.query.参数名

    • 动态路由传参 (优雅简洁,传单个参数比较方便)

      • ① 配置动态路由:path: “/path/参数名”
      • ② 跳转:to=“/path/参数值
      • ③ 获取:$route.params.参数名

(5)查询参数传参–代码演示

image-20230721144214534

  • Home.vue
<template><div class="home"><div class="logo-box"></div><div class="search-box"><input type="text"><button>搜索一下</button></div><div class="hot-link">热门搜索:<router-link to="/search?key=后端培训">后端培训</router-link><router-link to="/search?key=前端培训">前端培训</router-link><router-link to="/search?key=如何成为前端大牛">如何成为前端大牛</router-link></div></div>
</template><script>
export default {name: 'FindMusic'
}
</script><style>
.logo-box {height: 250px;background: url('@/assets/logo.jpeg') no-repeat center;
}
.search-box {display: flex;justify-content: center;
}
.search-box input {width: 400px;height: 30px;line-height: 30px;border: 2px solid #c4c7ce;border-radius: 4px 0 0 4px;outline: none;
}
.search-box input:focus {border: 2px solid #ad2a26;
}
.search-box button {width: 100px;height: 36px;border: none;background-color: #ad2a26;color: #fff;position: relative;left: -2px;border-radius: 0 4px 4px 0;
}
.hot-link {width: 508px;height: 60px;line-height: 60px;margin: 0 auto;
}
.hot-link a {margin: 0 5px;
}
</style>
  • Search.vue
<template><div class="search"><p>搜索关键字: {{ $route.query.key }} </p><p>搜索结果: </p><ul><li>.............</li><li>.............</li><li>.............</li><li>.............</li></ul></div>
</template><script>
export default {name: 'MyFriend',created () {// 在created中,获取路由参数// this.$route.query.参数名 获取console.log(this.$route.query.key);}
}
</script><style>
.search {width: 400px;height: 240px;padding: 0 20px;margin: 0 auto;border: 2px solid #c4c7ce;border-radius: 5px;
}
</style>

(6)动态路由传参–代码演示

image-20230721155736383

  • router/index.js中配置动态路由
import Home from '@/views/Home'
import Search from '@/views/Search'
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter) // VueRouter插件初始化// 创建了一个路由对象
const router = new VueRouter({routes: [{ path: '/home', component: Home },{ path: '/search/:words', component: Search }]
})export default router
  • Home.vue
<template><div class="home"><div class="logo-box"></div><div class="search-box"><input type="text"><button>搜索一下</button></div><div class="hot-link">热门搜索:<router-link to="/search/后端培训">后端培训</router-link><router-link to="/search/前端培训">前端培训</router-link><router-link to="/search/如何成为前端大牛">如何成为前端大牛</router-link></div></div>
</template><script>
export default {name: 'FindMusic'
}
</script><style>
.logo-box {height: 250px;background: url('@/assets/logo.jpeg') no-repeat center;
}
.search-box {display: flex;justify-content: center;
}
.search-box input {width: 400px;height: 30px;line-height: 30px;border: 2px solid #c4c7ce;border-radius: 4px 0 0 4px;outline: none;
}
.search-box input:focus {border: 2px solid #ad2a26;
}
.search-box button {width: 100px;height: 36px;border: none;background-color: #ad2a26;color: #fff;position: relative;left: -2px;border-radius: 0 4px 4px 0;
}
.hot-link {width: 508px;height: 60px;line-height: 60px;margin: 0 auto;
}
.hot-link a {margin: 0 5px;
}
</style>
  • Search.vue
<template><div class="search"><p>搜索关键字: {{ $route.params.words }} </p><p>搜索结果: </p><ul><li>.............</li><li>.............</li><li>.............</li><li>.............</li></ul></div>
</template><script>
export default {name: 'MyFriend',created () {// 在created中,获取路由参数// this.$route.query.参数名 获取查询参数// this.$route.params.参数名 获取动态路由参数console.log(this.$route.params.words);}
}
</script><style>
.search {width: 400px;height: 240px;padding: 0 20px;margin: 0 auto;border: 2px solid #c4c7ce;border-radius: 5px;
}
</style>

(7)动态路由参数可选符

  • **问题:**配了路由 path: "/search/:words" 为什么按下面步骤操作,会匹配不到组件,显示空白?
  • 原因: /search/:words 表示,必须要传参数。如果不传参数,也希望匹配,可以加个可选符 "?"

image-20230721094803301

  • router/index.js配置可选参数
import Home from '@/views/Home'
import Search from '@/views/Search'
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter) // VueRouter插件初始化// 创建了一个路由对象
const router = new VueRouter({routes: [{ path: '/home', component: Home },{ path: '/search/:words?', component: Search }]
})export default router
  • Home.vue不传参
<template><div class="home"><div class="logo-box"></div><div class="search-box"><input type="text"><button>搜索一下</button></div><div class="hot-link">热门搜索:<router-link to="/search/">后端培训</router-link><router-link to="/search/前端培训">前端培训</router-link><router-link to="/search/如何成为前端大牛">如何成为前端大牛</router-link></div></div>
</template><script>
export default {name: 'FindMusic'
}
</script><style>
.logo-box {height: 250px;background: url('@/assets/logo.jpeg') no-repeat center;
}
.search-box {display: flex;justify-content: center;
}
.search-box input {width: 400px;height: 30px;line-height: 30px;border: 2px solid #c4c7ce;border-radius: 4px 0 0 4px;outline: none;
}
.search-box input:focus {border: 2px solid #ad2a26;
}
.search-box button {width: 100px;height: 36px;border: none;background-color: #ad2a26;color: #fff;position: relative;left: -2px;border-radius: 0 4px 4px 0;
}
.hot-link {width: 508px;height: 60px;line-height: 60px;margin: 0 auto;
}
.hot-link a {margin: 0 5px;
}
</style>
  • Search.vue
<template><div class="search"><p>搜索关键字: {{ $route.params.words }} </p><p>搜索结果: </p><ul><li>.............</li><li>.............</li><li>.............</li><li>.............</li></ul></div>
</template><script>
export default {name: 'MyFriend',created () {// 在created中,获取路由参数// this.$route.query.参数名 获取查询参数// this.$route.params.参数名 获取动态路由参数console.log(this.$route.params.words);}
}
</script><style>
.search {width: 400px;height: 240px;padding: 0 20px;margin: 0 auto;border: 2px solid #c4c7ce;border-radius: 5px;
}
</style>
  • 效果:传进去的值是空

image-20230721170820039

7、路由重定向

(1)路由重定向

  • **问题:**网页打开, url 默认是 / 路径,未匹配到组件时,会出现空白
  • **说明:**重定向 → 匹配path后, 强制跳转path路径
  • 语法: { path: 匹配路径, redirect: 重定向到的路径 }

image-20230721164127146

(2)路由404

  • **作用:**当路径找不到匹配时,给个提示页面
  • **位置:**配在路由最后
  • **语法:**path: “*” (任意路径) – 前面不匹配就命中最后这个

image-20230721220004472

image-20230721220027310

(3)路由模式

  • 问题: 路由的路径看起来不自然, 有#,能否切成真正路径形式?
    • hash路由(默认) 例如: http://localhost:8080/#/home
    • history路由(常用) 例如: http://localhost:8080/home (以后上线需要服务器端支持)

image-20230721220145618

8、编程式导航

(1)基本跳转

  • 点击按钮跳转如何实现?用JS代码来进行跳转,两种语法:

    • ① path 路径跳转 (简易方便)

    image-20230721222853602

    • ② name 命名路由跳转 (适合 path 路径长的场景)

image-20230721222930163

  • 代码实现:Home.vue
<template><div class="home"><div class="logo-box"></div><div class="search-box"><input type="text"><button @click="goSearch">搜索一下</button></div><div class="hot-link">热门搜索:<router-link to="/search/后端培训">后端培训</router-link><router-link to="/search/前端培训">前端培训</router-link><router-link to="/search/如何成为前端大牛">如何成为前端大牛</router-link></div></div>
</template><script>
export default {name: 'FindMusic',methods: {goSearch () {// 1. 通过路径的方式跳转// (1) this.$router.push('路由路径') [简写]// this.$router.push('/search')// (2) this.$router.push({     [完整写法]//         path: '路由路径' //     })// this.$router.push({//   path: '/search'// })// 2. 通过命名路由的方式跳转 (需要给路由起名字) 适合长路径//    this.$router.push({//        name: '路由名'//    })this.$router.push({name: 'search'})}}
}
</script><style>
.logo-box {height: 250px;background: url('@/assets/logo.jpeg') no-repeat center;
}
.search-box {display: flex;justify-content: center;
}
.search-box input {width: 400px;height: 30px;line-height: 30px;border: 2px solid #c4c7ce;border-radius: 4px 0 0 4px;outline: none;
}
.search-box input:focus {border: 2px solid #ad2a26;
}
.search-box button {width: 100px;height: 36px;border: none;background-color: #ad2a26;color: #fff;position: relative;left: -2px;border-radius: 0 4px 4px 0;
}
.hot-link {width: 508px;height: 60px;line-height: 60px;margin: 0 auto;
}
.hot-link a {margin: 0 5px;
}
</style>

(2)路由传参

  • 两种传参方式:查询参数+动态路由传参,两种跳转方式,对于两种传参方式都支持

  • path 路径跳转

    • ① query传参

    image-20230723223552398

    • ② 动态路由传参 (需要配动态路由)

    image-20230723223603603

  • name 命名路由跳转

    • ① query传参

    image-20230723223617466

    • ② 动态路由传参 (需要配动态路由)

    image-20230723223629268

  • 代码实现

    • Home.vue传参
    <template><div class="home"><div class="logo-box"></div><div class="search-box"><input v-model="inpValue" type="text"><button @click="goSearch">搜索一下</button></div><div class="hot-link">热门搜索:<router-link to="/search/后端培训">后端培训</router-link><router-link to="/search/前端培训">前端培训</router-link><router-link to="/search/如何成为前端大牛">如何成为前端大牛</router-link></div></div>
    </template><script>
    export default {name: 'FindMusic',data () {return {inpValue: ''}},methods: {goSearch () {// 1. 通过路径的方式跳转// (1) this.$router.push('路由路径') [简写]//     this.$router.push('路由路径?参数名=参数值')// this.$router.push('/search')// this.$router.push(`/search?key=${this.inpValue}`)// this.$router.push(`/search/${this.inpValue}`)// (2) this.$router.push({     [完整写法] 更适合传参//         path: '路由路径'//         query: {//            参数名: 参数值,//            参数名: 参数值//         }//     })// this.$router.push({//   path: '/search',//   query: {//     key: this.inpValue//   }// })// this.$router.push({//   path: `/search/${this.inpValue}`// })// 2. 通过命名路由的方式跳转 (需要给路由起名字) 适合长路径//    this.$router.push({//        name: '路由名'//        query: { 参数名: 参数值 },//        params: { 参数名: 参数值 }//    })this.$router.push({name: 'search',// query: {//   key: this.inpValue// }params: {words: this.inpValue}})}}
    }
    </script><style>
    .logo-box {height: 250px;background: url('@/assets/logo.jpeg') no-repeat center;
    }
    .search-box {display: flex;justify-content: center;
    }
    .search-box input {width: 400px;height: 30px;line-height: 30px;border: 2px solid #c4c7ce;border-radius: 4px 0 0 4px;outline: none;
    }
    .search-box input:focus {border: 2px solid #ad2a26;
    }
    .search-box button {width: 100px;height: 36px;border: none;background-color: #ad2a26;color: #fff;position: relative;left: -2px;border-radius: 0 4px 4px 0;
    }
    .hot-link {width: 508px;height: 60px;line-height: 60px;margin: 0 auto;
    }
    .hot-link a {margin: 0 5px;
    }
    </style>
    
    • Search.vue接受参数
    <template><div class="search"><p>搜索关键字: {{ $route.params.words }} </p><p>搜索结果: </p><ul><li>.............</li><li>.............</li><li>.............</li><li>.............</li></ul></div>
    </template><script>
    export default {name: 'MyFriend',created () {// 在created中,获取路由参数// this.$route.query.参数名 获取查询参数// this.$route.params.参数名 获取动态路由参数// console.log(this.$route.params.words);}
    }</script><style>
    .search {width: 400px;height: 240px;padding: 0 20px;margin: 0 auto;border: 2px solid #c4c7ce;border-radius: 5px;
    }
    </style>
    

相关文章:

Vue2基础九、路由

零、文章目录 Vue2基础九、路由 1、单页应用 &#xff08;1&#xff09;单页应用是什么 单页面应用(SPA&#xff1a;Single Page Application): 所有功能在 一个html页面 上实现具体示例: 网易云音乐 https://music.163.com/ &#xff08;2&#xff09;单页面应用VS多页面…...

移动零——力扣283

题目描述 双指针 class Solution{ public:void moveZeroes(vector<int>& nums){int n nums.size(), left0, right0;while(right<n){if(nums[right]){swap(nums[right], nums[left]);left;}right;}} };...

Transformer+MIA Future Work

TransformerMIA Future Work 主要的挑战和未来发展分为三个部分&#xff0c;即 1、特征集成和计算成本降低、 2、数据增强和数据集收集、 3、学习方式和模态-对象分布 1、特征集成和计算成本降低 为了同时捕获局部和全局特征来提高模型性能&#xff0c;目前大多数工作只是…...

深度学习入门(二):神经网络整体架构

一、前向传播 作用于每一层的输入&#xff0c;通过逐层计算得到输出结果 二、反向传播 作用于网络输出&#xff0c;通过计算梯度由深到浅更新网络参数 三、整体架构 层次结构&#xff1a;逐层变换数据 神经元&#xff1a;数据量、矩阵大小&#xff08;代表输入特征的数量…...

rust 配置

rustup 镜像 在 cmd 中输入以下代码&#xff0c;设置环境变量 setx RUSTUP_UPDATE_ROOT https://mirrors.tuna.tsinghua.edu.cn/rustup/rustup setx RUSTUP_DIST_SERVER https://mirrors.tuna.tsinghua.edu.cn/rustupcrates.io 索引镜像 在 C:\Users\用户名\.cargo\config 文…...

文心一言 VS 讯飞星火 VS chatgpt (67)-- 算法导论6.5 6题

文心一言 VS 讯飞星火 VS chatgpt &#xff08;67&#xff09;-- 算法导论6.5 6题 六、在 HEAP-INCREASE-KEY 的第 5 行的交换操作中&#xff0c;一般需要通过三次赋值来完成。想一想如何利用INSERTION-SORT 内循环部分的思想&#xff0c;只用一次赋值就完成这一交换操作? 文…...

6、Kubernetes核心技术 - Pod

目录 一、概述 二、Pod机制 2.1、共享网络 2.2、共享存储 三、Pod资源清单 四、 Pod 的分类 五、Pod阶段 六、Pod 镜像拉取策略 ImagePullBackOff 七、Pod 资源限制 八、容器重启策略 一、概述 Pod 是可以在 Kubernetes 中创建和管理的、最小的可部署的计算单元。P…...

VlanIf虚拟接口 通信技术(二十三课)

一 Vlan技术之间的通信 单臂路由(One-Arm Routing)是一种网络架构设计方式,通常用于部署网络设备(如防火墙、负载均衡器等)实现网络流量控制和安全策略。在单臂路由中,网络设备只有一个物理接口与局域网(LAN)或广域网(WAN)相连。 1.2 交换机 数据链路层 (第二层)…...

图神经网络(GNN)入门学习笔记(直观且简单)

文章目录 图的定义和表示可以使用图数据结构的问题将图结构用于机器学习的挑战最基本的图神经网络概述汇聚操作基于信息传递的改进图神经网络全局向量信息的利用 本篇文章参考发表于Distill上的图神经网络入门博客&#xff1a; A Gentle Introduction to Graph Neural Network…...

【Java开发】 Mybatis-Flex 01:快速入门

Mybatis 作为头部的 ORM 框架&#xff0c;他的增强工具可谓层出不穷&#xff0c;比如出名的 Mybatis-Plus 和 阿里云开源的 Fluent-MyBatis&#xff0c;如今出了一款 Mybatis-Flex &#xff0c;相比前两款功能更为强大、性能更为强悍&#xff0c;不妨来了解一下。 目录 1 Myba…...

企业级业务架构学习笔记<二>

一.业务架构基础 业务架构的定义 以实现企业战略为目标&#xff0c;构建企业整体业务能力规划并将其传导给技术实现端的结构化企业能力分析方法 (业务架构可以从企业战略触发&#xff0c;按照企业战略设计业务及业务过程&#xff0c;业务过程时需要业务能力支撑的&#xff0…...

Minio在windows环境配置https访问

minio启动后&#xff0c;默认访问方式为http&#xff0c;但是有的时候我们的访问场景必须是https&#xff0c;浏览器有的会默认以https进行访问&#xff0c;这个时候就需要我们进行配置上的调整&#xff0c;将minio从http访问升级到https。而查看minio的官方文档&#xff0c;并…...

安装JDK环境(Windows+Linux双教程)

今日一语&#xff1a;今天的事情不去做&#xff0c;到了明天就成了麻烦&#xff0c;到了下个月就成了隐患&#xff0c;到了明年只剩下悔恨和惋惜 Linux 从Oracle网站下载linux的rpm包java -version 查询java环境是否已经安装 如果已经安装&#xff0c;可以选择卸载重装或者直接…...

SVG图标,SVG symbols,SVG use标签

SVG图标&#xff0c;SVG symbols 项目中图标的使用&#xff0c;趋势是使用svg作图标的&#xff0c;优点如下 兼容现有图片能力前提还支持矢量 可读性好&#xff0c;有利于SEO与无障碍 在性能和维护性方面也比iconfont要强很多 怎么在项目中优雅的使用svg图标&#xff0c;下面…...

常用css 笔记

0、定义变量 :root { --primary-color: #007bff;} .button { background-color: var(--primary-color);} 1、水平垂直居中 div {width: 100px;height: 100px;position: absolute;top: 0;right: 0;bottom: 0;left: 0;margin: auto; }父级控制子集居中 .parent {display: fle…...

git的ssh方式对接码云

一、环境准备&#xff1a; 1、git下载&#xff0c;360管家或是百度。 2、vs2022&#xff0c;百度下载。 二、配置git&#xff1a; 1、打开准备存放文件的文件夹&#xff0c;右键&#xff0c;选择“Git Bash here”&#xff0c;弹出命令窗口&#xff0c; 输入&#xff1a;ss…...

Golang之路---02 基础语法——变量

Golang变量 变量的声明 声明变量的一般形式是使用 var 关键字 Go 语言是静态类型语言&#xff0c;编译时&#xff0c;编译器会检查变量的类型&#xff0c;所以要求所有的变量都要有明确的类型。 1 &#xff1a;一个变量单行声明 语法格式&#xff1a; var name type var是关…...

Webpack5 DefinePlugin的作用

在Webpack 5中&#xff0c;DefinePlugin是一个插件&#xff0c;用于创建全局常量&#xff0c;这些常量可以在编译过程中被引用。它的作用是允许开发人员在代码中定义全局变量&#xff0c;这些变量在构建过程中将被替换为其对应的值。 DefinePlugin并不是必须的&#xff0c;但它…...

Verilog语法学习——LV7_求两个数的差值

LV7_求两个数的差值 题目来源于牛客网 [牛客网在线编程_Verilog篇_Verilog快速入门 (nowcoder.com)](https://www.nowcoder.com/exam/oj?page1&tabVerilog篇&topicId301) 题目 描述 根据输入信号a,b的大小关系&#xff0c;求解两个数的差值&#xff1a;输入信号a,b…...

C#匿名函数,lambda表达式笔记

一.匿名函数 匿名函数是一种定义时不起函数名的技术&#xff0c;因此无法直接调用&#xff0c;通常用来赋值给委托后被委托调用。在匿名方法中您不需要指定返回类型&#xff0c;它是从方法主体内的 return 语句推断的 它的语法形式为&#xff1a;delegate (input-parameters)…...

【机器视觉】单目测距——运动结构恢复

ps&#xff1a;图是随便找的&#xff0c;为了凑个封面 前言 在前面对光流法进行进一步改进&#xff0c;希望将2D光流推广至3D场景流时&#xff0c;发现2D转3D过程中存在尺度歧义问题&#xff0c;需要补全摄像头拍摄图像中缺失的深度信息&#xff0c;否则解空间不收敛&#xf…...

【Go】3、Go语言进阶与依赖管理

前言 本系列文章参考自稀土掘金上的 【字节内部课】公开课&#xff0c;做自我学习总结整理。 Go语言并发编程 Go语言原生支持并发编程&#xff0c;它的核心机制是 Goroutine 协程、Channel 通道&#xff0c;并基于CSP&#xff08;Communicating Sequential Processes&#xff0…...

【HarmonyOS 5 开发速记】如何获取用户信息(头像/昵称/手机号)

1.获取 authorizationCode&#xff1a; 2.利用 authorizationCode 获取 accessToken&#xff1a;文档中心 3.获取手机&#xff1a;文档中心 4.获取昵称头像&#xff1a;文档中心 首先创建 request 若要获取手机号&#xff0c;scope必填 phone&#xff0c;permissions 必填 …...

【MATLAB代码】基于最大相关熵准则(MCC)的三维鲁棒卡尔曼滤波算法(MCC-KF),附源代码|订阅专栏后可直接查看

文章所述的代码实现了基于最大相关熵准则(MCC)的三维鲁棒卡尔曼滤波算法(MCC-KF),针对传感器观测数据中存在的脉冲型异常噪声问题,通过非线性加权机制提升滤波器的抗干扰能力。代码通过对比传统KF与MCC-KF在含异常值场景下的表现,验证了后者在状态估计鲁棒性方面的显著优…...

nnUNet V2修改网络——暴力替换网络为UNet++

更换前,要用nnUNet V2跑通所用数据集,证明nnUNet V2、数据集、运行环境等没有问题 阅读nnU-Net V2 的 U-Net结构,初步了解要修改的网络,知己知彼,修改起来才能游刃有余。 U-Net存在两个局限,一是网络的最佳深度因应用场景而异,这取决于任务的难度和可用于训练的标注数…...

vue3 daterange正则踩坑

<el-form-item label"空置时间" prop"vacantTime"> <el-date-picker v-model"form.vacantTime" type"daterange" start-placeholder"开始日期" end-placeholder"结束日期" clearable :editable"fal…...

高分辨率图像合成归一化流扩展

大家读完觉得有帮助记得关注和点赞&#xff01;&#xff01;&#xff01; 1 摘要 我们提出了STARFlow&#xff0c;一种基于归一化流的可扩展生成模型&#xff0c;它在高分辨率图像合成方面取得了强大的性能。STARFlow的主要构建块是Transformer自回归流&#xff08;TARFlow&am…...

结构化文件管理实战:实现目录自动创建与归类

手动操作容易因疲劳或疏忽导致命名错误、路径混乱等问题&#xff0c;进而引发后续程序异常。使用工具进行标准化操作&#xff0c;能有效降低出错概率。 需要快速整理大量文件的技术用户而言&#xff0c;这款工具提供了一种轻便高效的解决方案。程序体积仅有 156KB&#xff0c;…...

ubuntu中安装conda的后遗症

缘由: 在编译rk3588的sdk时&#xff0c;遇到编译buildroot失败&#xff0c;提示如下&#xff1a; 提示缺失expect&#xff0c;但是实测相关工具是在的&#xff0c;如下显示&#xff1a; 然后查找借助各个ai工具&#xff0c;重新安装相关的工具&#xff0c;依然无解。 解决&am…...

Qwen系列之Qwen3解读:最强开源模型的细节拆解

文章目录 1.1分钟快览2.模型架构2.1.Dense模型2.2.MoE模型 3.预训练阶段3.1.数据3.2.训练3.3.评估 4.后训练阶段S1: 长链思维冷启动S2: 推理强化学习S3: 思考模式融合S4: 通用强化学习 5.全家桶中的小模型训练评估评估数据集评估细节评估效果弱智评估和民间Arena 分析展望 如果…...