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

第三十七章 Vue之编程式导航及跳转传参

目录

一、编程式导航跳转方式

1.1. path 路径跳转

1.1.1. 使用方式

1.1.2. 完整代码

1.1.2.1. main.js

1.1.2.2. App.vue

1.1.2.3. index.js

1.1.2.4. Home.vue

1.1.2.5. Search.vue 

1.2. name 命名路由跳转

1.2.1. 使用方式

1.2.2. 完整代码

1.2.2.1. main.js

1.2.2.2. Home.vue 

二、编程式导航跳转传参

2.1. path路径跳转传参

2.1.1. 查询参数传参(简写)

2.1.1.1. Home.vue

2.1.1.2. Search.vue

2.1.2. 查询参数传参(完整写法)

2.1.2.1. Home.vue

2.1.3. 动态路由传参(简写)

2.1.3.1. index.js

2.1.3.2. Home.vue

2.1.3.3. Search.vue

2.1.4. 动态路由传参(完整写法)

2.2. name命名路由跳转传参

2.2.1. 查询参数传参

2.1.1.1. Home.vue

2.1.1.2. Search.vue

2.1.1.3. index.js

2.2.2. 动态路由传参

2.1.3.1. index.js

2.1.3.2. Home.vue

2.1.3.3. Search.vue


一、编程式导航跳转方式

前面的章节我们学习了声明式导航的路由跳转,简单理解就是通过链接形式的路由跳转,本章节我们来学习下编程式导航跳转,即点击按钮来实现页面的跳转。在Vue中提供了两种实现方式。

1.1. path 路径跳转

特点:简易方便

1.1.1. 使用方式

1.1.2. 完整代码

1.1.2.1. 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')
1.1.2.2. App.vue
<template><div id="app"><div class="link"><router-link to="/home">首页</router-link><router-link to="/search">搜索页</router-link></div><router-view></router-view></div>
</template><script>
export default {};
</script><style scoped>
.link {height: 50px;line-height: 50px;background-color: #495150;display: flex;margin: -8px -8px 0 -8px;margin-bottom: 50px;
}
.link a {display: block;text-decoration: none;background-color: #ad2a26;width: 100px;text-align: center;margin-right: 5px;color: #fff;border-radius: 5px;
}
</style>
1.1.2.3. 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: '/', redirect: '/home' },{ path: '/home', component: Home },{ path: '/search', component: Search }],mode: "history"
})export default router
1.1.2.4. 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/?key=王哲晓">王哲晓</router-link><router-link to="/search?key=学习Vue">学习Vue</router-link><router-link to="/search?key=想成为大牛的前提先得持续学习">想成为大牛的前提先得持续学习</router-link></div></div>
</template><script>
export default {name: 'FindMusic',methods: {goSearch () {// 通过路径的方式跳转的两种写法// (1) 简写// this.$router.push('路由路径')// this.$router.push('/search')// (2) 完整写法// this.$router.push({//   path: '路由路径'// })this.$router.push({path: '/search'})}}
}
</script><style>
.logo-box {height: 150px;background: url('@/assets/vue.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>​
1.1.2.5. 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 () {console.log(this.$route.query);}
}
</script><style>
.search {width: 400px;height: 240px;padding: 0 20px;margin: 0 auto;border: 2px solid #c4c7ce;border-radius: 5px;
}
</style>

1.2. name 命名路由跳转

特点:适合 path 路径长的场景

1.2.1. 使用方式

通过name属性定义路由名 

跳转方法中通过name属性指定路由即可 

1.2.2. 完整代码

在前面的代码基础上做适当调整:

1.2.2.1. main.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: '/', redirect: '/home' },{ path: '/home', component: Home },{ name: 'search', path: '/search/:words?', component: Search }],mode: "history"
})export default router
1.2.2.2. 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/?key=王哲晓">王哲晓</router-link><router-link to="/search?key=学习Vue">学习Vue</router-link><router-link to="/search?key=想成为大牛的前提先得持续学习">想成为大牛的前提先得持续学习</router-link></div></div>
</template><script>
export default {name: 'FindMusic',methods: {goSearch () {// 通过命名路由的方式跳转(需要给路由起名字)// this.$router.push({//   name: '路由名'// })this.$router.push({name: 'search'})}}
}
</script><style>
.logo-box {height: 150px;background: url('@/assets/vue.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.1. path路径跳转传参

2.1.1. 查询参数传参(简写)

传递多个参数通过&分隔:

取值方式:

2.1.1.1. 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/?key=王哲晓">王哲晓</router-link><router-link to="/search?key=学习Vue">学习Vue</router-link><router-link to="/search?key=想成为大牛的前提先得持续学习">想成为大牛的前提先得持续学习</router-link></div></div>
</template><script>
export default {name: 'FindMusic',data () {return {inpValue: ''}},methods: {goSearch () {// 简写// this.$router.push(`路由路径?参数名1=参数值1&参数名2=参数值2`)this.$router.push(`/search?key=${this.inpValue}`)}}
}
</script><style>
.logo-box {height: 150px;background: url('@/assets/vue.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.1.1.2. 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 () {console.log(this.$route.query);}
}
</script><style>
.search {width: 400px;height: 240px;padding: 0 20px;margin: 0 auto;border: 2px solid #c4c7ce;border-radius: 5px;
}
</style>

2.1.2. 查询参数传参(完整写法)

更适合传递多个参数

 取值方式与上面相同:

2.1.2.1. 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/?key=王哲晓">王哲晓</router-link><router-link to="/search?key=学习Vue">学习Vue</router-link><router-link to="/search?key=想成为大牛的前提先得持续学习">想成为大牛的前提先得持续学习</router-link></div></div>
</template><script>
export default {name: 'FindMusic',data () {return {inpValue: ''}},methods: {goSearch () {// 完整写法,更适合传参// this.$router.push({ //   path: '路由路径',//   query: {//     参数名: 参数值,//     参数名: 参数值//   }// })this.$router.push({path: '/search',query: {key: this.inpValue}})}}
}
</script><style>
.logo-box {height: 150px;background: url('@/assets/vue.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.1.3. 动态路由传参(简写)

取值方式:

2.1.3.1. 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: '/', redirect: '/home' },{ path: '/home', component: Home },{ path: '/search/:words?', component: Search }],mode: "history"
})export default router
2.1.3.2. 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/?key=王哲晓">王哲晓</router-link><router-link to="/search?key=学习Vue">学习Vue</router-link><router-link to="/search?key=想成为大牛的前提先得持续学习">想成为大牛的前提先得持续学习</router-link></div></div>
</template><script>
export default {name: 'FindMusic',methods: {goSearch () {this.$router.push(`/search/${this.inpValue}`)}}
}
</script><style>
.logo-box {height: 150px;background: url('@/assets/vue.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.1.3.3. 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 () {console.log(this.$route.query);}
}
</script><style>
.search {width: 400px;height: 240px;padding: 0 20px;margin: 0 auto;border: 2px solid #c4c7ce;border-radius: 5px;
}
</style>

2.1.4. 动态路由传参(完整写法)

Home.vue的代码在前者基础上稍做调整即可,获取方式等代码一样。

2.2. name命名路由跳转传参

2.2.1. 查询参数传参

传递多个参数通过&分隔:

取值方式:

2.1.1.1. 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/?key=王哲晓">王哲晓</router-link><router-link to="/search?key=学习Vue">学习Vue</router-link><router-link to="/search?key=想成为大牛的前提先得持续学习">想成为大牛的前提先得持续学习</router-link></div></div>
</template><script>
export default {name: 'FindMusic',data () {return {inpValue: ''}},methods: {goSearch () {this.$router.push({name: 'search',query: {key: this.inpValue}})}}
}
</script><style>
.logo-box {height: 150px;background: url('@/assets/vue.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.1.1.2. 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 () {console.log(this.$route.query);}
}
</script><style>
.search {width: 400px;height: 240px;padding: 0 20px;margin: 0 auto;border: 2px solid #c4c7ce;border-radius: 5px;
}
</style>
2.1.1.3. 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: '/', redirect: '/home' },{ path: '/home', component: Home },{ name: 'search', path: '/search', component: Search }],mode: "history"
})export default router

2.2.2. 动态路由传参

取值方式:

2.1.3.1. 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: '/', redirect: '/home' },{ path: '/home', component: Home },{ name: 'search', path: '/search:words?', component: Search }],mode: "history"
})export default router
2.1.3.2. 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/?key=王哲晓">王哲晓</router-link><router-link to="/search?key=学习Vue">学习Vue</router-link><router-link to="/search?key=想成为大牛的前提先得持续学习">想成为大牛的前提先得持续学习</router-link></div></div>
</template><script>
export default {name: 'FindMusic',data () {return {inpValue: ''}},methods: {goSearch () {this.$router.push({name: 'search',params: {words: this.inpValue}})}}
}
</script><style>
.logo-box {height: 150px;background: url('@/assets/vue.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.1.3.3. 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 () {console.log(this.$route.query);}
}
</script><style>
.search {width: 400px;height: 240px;padding: 0 20px;margin: 0 auto;border: 2px solid #c4c7ce;border-radius: 5px;
}
</style>

相关文章:

第三十七章 Vue之编程式导航及跳转传参

目录 一、编程式导航跳转方式 1.1. path 路径跳转 1.1.1. 使用方式 1.1.2. 完整代码 1.1.2.1. main.js 1.1.2.2. App.vue 1.1.2.3. index.js 1.1.2.4. Home.vue 1.1.2.5. Search.vue 1.2. name 命名路由跳转 1.2.1. 使用方式 1.2.2. 完整代码 1.2.2.1. main.js 1…...

vue 版本升级

Vue 3.4 升级了组件产值方式 v-model &#xff0c;果断升级玩玩&#xff0c;记录一下升级过程 我的原Vue版本是3.2.13 升级到目前最新3.5.12 1. npm add vuelatest 2. npm add -g vue/clilatest 安装完成后记得查看是否有如下警告 这个警告是说eslint-plugin-vue package…...

探索Copier:Python项目模板的革命者

文章目录 **探索Copier&#xff1a;Python项目模板的革命者**1. 背景介绍&#xff1a;为何Copier成为新宠&#xff1f;2. Copier是什么&#xff1f;3. 如何安装Copier&#xff1f;4. 简单库函数使用方法4.1 创建模板4.2 从Git URL创建项目4.3 使用快捷方式4.4 动态替换文本4.5 …...

云原生后端深度解析

云原生后端 云原生后端是指专门为云计算环境设计的软件架构和服务。它强调了应用程序的设计、开发、部署和运维的方式&#xff0c;以充分利用云平台提供的弹性、可伸缩性和自动化能力。云原生技术主要包括容器化、微服务、不可变基础设施、声明式APIs等核心概念。下面是对这些…...

本地 SSL 证书生成神器,自己创建SSL

本地 SSL 证书生成神器,自己创建SSL 在本地环境中配置HTTPS一直以来是开发者的痛点,手动创建SSL证书、配置信任存储不仅繁琐,还容易出错。今天给大家介绍一个开源神器——mkcert!它能让你快速生成本地受信任的SSL/TLS证书,轻松打造安全的HTTPS开发环境,成为许多开发者的首…...

HCIP-快速生成树RSTP

一、RSTP是什么 STP&#xff08;Spanning Tree Protocol &#xff09;是生成树协议的英文缩写。该协议可应用于环路网络&#xff0c;通过一定的算法实现路径冗余&#xff0c;同时将环路网络修剪成无环路的树型网络&#xff0c;从而避免报文在环路网络中的增生和无限循环。 RS…...

企业级RAG(检索增强生成)系统构建研究

— 摘要 检索增强生成&#xff08;Retrieval-Augmented Generation&#xff0c;RAG&#xff09;技术已经成为企业在知识管理、信息检索和智能问答等应用中的重要手段。本文将从RAG系统的现状、方法论、实践案例、成本分析、实施挑战及应对策略等方面&#xff0c;探讨企业如何…...

MATLAB基础应用精讲-【数模应用】Google Caffeine算法

目录 前言 算法原理 Caffeine算法的背景和优势 什么是Caffeine算法 Caffeine算法的工作原理 常见的缓存数据淘汰算法 FIFO LRU LFU W-TinyLFU Caffeine W-TinyLFU 实现 元素驱逐 元素访问 Caffeine 的四种缓存添加策略 1. 手动加载 2. 自动加载 3. 手动异步加载…...

第十九届中国国际中小企业博览会将在粤开展

11月15日-18日&#xff0c;第十九届中国国际中小企业博览会&#xff08;简称“中博会”&#xff09;将在广州广交会展馆举办&#xff0c;共设8个展厅&#xff0c;展位总数约2800个&#xff0c;将举办超过30场系列配套活动&#xff0c;35个国家&#xff08;地区&#xff09;和国…...

云计算在智能交通系统中的应用

&#x1f493; 博客主页&#xff1a;瑕疵的CSDN主页 &#x1f4dd; Gitee主页&#xff1a;瑕疵的gitee主页 ⏩ 文章专栏&#xff1a;《热点资讯》 云计算在智能交通系统中的应用 云计算在智能交通系统中的应用 云计算在智能交通系统中的应用 引言 云计算概述 定义与原理 发展历…...

b4tman / docker-squid 可快速安装运行的、容器型代理服务器 + podman

使用容器部署&#xff0c;省时省力。 使用镜像&#xff0c;目前的最大麻烦就是之前各大镜像源纷纷关闭&#xff0c;需要自己找到合适的、安全的镜像源。 幸好 docker-squid 推广在 ghcr.io&#xff0c;目前下载没有障碍。 注&#xff1a;ghcr.io 是 GitHub Container Registry …...

脉冲神经网络(Spiking Neural Network,SNN)学习(1)

目录 一、神经网络 1、神经元 2、激活函数 &#xff08;1&#xff09;常见的激活函数&#xff1a;Sigmoid函数 &#xff08;2&#xff09;常见的激活函数&#xff1a;ReLU&#xff08;Rectified Linear Unit&#xff09;函数 &#xff08;3&#xff09;常见的激活函数&…...

【疑难杂症】电脑休眠后无法开机,进入 steamVR 时电脑突然黑屏关机

问题描述 1.电脑休眠后无法启动&#xff0c;只能拔电源再启动 2.进入 steamVR 时&#xff0c;电脑突然断电黑屏关机&#xff08;无蓝屏&#xff0c;无任何报错&#xff09; 3.在进行渲染时&#xff0c;如R23等&#xff0c;电脑突然黑屏关机 4.进入 VRChat 时&#xff0c;准备进…...

HTML文件中引入jQuery的库文件

方法一&#xff1a; 1. 首先&#xff0c;在官方网站(https://jquery.com/)上下载最新版本的jQuery库文件&#xff0c;通常是一个名为jquery-x.x.x.min.js的文件。 2. 将下载的jquery-x.x.x.min.js文件保存到你的项目目录中的一个合适的文件夹中&#xff0c;比如将它保存在你的项…...

IntelliJ IDEA超详细下载安装教程(附安装包)

目录 IDEA的简单介绍一、下载IDEA二、安装IDEA三、启动IDEA并使用1.配置IDEA2.输出&#xff1a;"Hello World&#xff01;" IDEA的简单介绍 IDEA 全称IntelliJ IDEA&#xff0c;是由 JetBrains 开发的一款广泛使用的集成开发环境&#xff08;IDE&#xff09;&#x…...

MySQL技巧之跨服务器数据查询:基础篇-更新语句如何写

MySQL技巧之跨服务器数据查询&#xff1a;基础篇-更新语句如何写 上一篇已经描述&#xff1a;借用微软的SQL Server ODBC 即可实现MySQL跨服务器间的数据查询。 而且还介绍了如何获得一个在MS SQL Server 可以连接指定实例的MySQL数据库的连接名: MY_ODBC_MYSQL 以及用同样的…...

期权懂|期权新手入门教学:期权合约有哪些要素?

期权小懂每日分享期权知识&#xff0c;帮助期权新手及时有效地掌握即市趋势与新资讯&#xff01; 期权新手入门教学&#xff1a;期权合约有哪些要素&#xff1f; 期权合约&#xff1a;是指约定买方有权在将来某一时间以特定价格买入或卖出约定标的物的标准化或非标准化合约。期…...

腾讯云nginx SSL证书配置

本章教程,记录在使用腾讯云域名nginx证书配置SSL配置过程。 一、nginx配置 域名和证书,替换成自己的即可。证书文件可以自定义路径位置。服务器安全组或者防火墙需要开放80和443端口。 server {#SSL 默认访问端口号为 443listen 443 ssl; #请填写绑定证书的域名server_name c…...

重新认识HTTPS

一. 什么是 HTTPS HTTP 由于是明文传输&#xff0c;所谓的明文&#xff0c;就是说客户端与服务端通信的信息都是肉眼可见的&#xff0c;随意使用一个抓包工具都可以截获通信的内容。 所以安全上存在以下三个风险&#xff1a; 窃听风险&#xff0c;比如通信链路上可以获取通信…...

应用于新能源汽车NCV4275CDT50RKG车规级LDO线性电压调节器芯片

关于车规级芯片&#xff08;Automotive Grade Chip&#xff09;&#xff0c;车规级芯片是专门用于汽车行业的芯片&#xff0c;具有高可靠性、高稳定性和低功耗等特点&#xff0c;以满足汽车电子系统的严格要求。这些芯片通常用于车载电子控制单元&#xff08;ECU&#xff09;和…...

【Python】第一弹:对 Python 的认知

目录 一、Python 的背景 1.1. Python 的由来 1.2 Python 的作用 1.3 Python 的优缺点 1.4 Python 的开发工具 一、Python 的背景 1.1. Python 的由来 Python 由荷兰数学和计算机科学研究学会的吉多・范罗苏姆 &#xff08;Guido van Rossum&#xff09;在 20 世纪 80 年代…...

8.5 Q1|广州医科大学CHARLS发文 甘油三酯葡萄糖指数累积变化与 0-3期心血管-肾脏-代谢综合征人群中风发生率的相关性

1.第一段-文章基本信息 文章题目&#xff1a;Association between cumulative changes of the triglyceride glucose index and incidence of stroke in a population with cardiovascular-kidney-metabolic syndrome stage 0-3: a nationwide prospective cohort study 中文标…...

JavaScript es6 语法 map().filter() 链式调用,语法解析 和常见demo

摘要&#xff1a; map&#xff1a;遍历数组并对每个元素执行回调函数&#xff0c;返回一个新数组 filter&#xff1a;对 map 返回的数组进行过滤&#xff0c;返回满足条件的元素组成的新数组 1.数字数组处理 const numbers [1, 2, 3, 4, 5];// 先平方&#xff0c;再筛选偶数…...

Java构建Tree并实现节点名称模糊查询

乐于学习分享… 大家加油努力 package com.tom.backtrack;import lombok.Data; import lombok.Getter;import java.util.ArrayList; import java.util.List; import java.util.Objects;/*** 树节点** author zx* date 2025-05-27 19:51*/ Data public class TreeNode {private …...

华为FreeArc能和其他华为产品共用充电线吗?

最近刚买的FreeArc终于到手啦&#xff0c;看到网上有朋友说&#xff0c;这次的耳机是不附带充电线&#xff0c;开箱后发现果真如此&#xff0c;那FreeArc到底用什么规格的充电线&#xff0c;能不能和华为的Type-C数据线通用&#xff0c;我来给大家解答一下吧&#xff01; Free…...

电脑如何保养才能用得更久

在这个数字化的时代&#xff0c;电脑已经成为了我们生活和工作中不可或缺的伙伴。无论是处理工作文档、追剧娱乐&#xff0c;还是进行创意设计&#xff0c;电脑都发挥着至关重要的作用。那么&#xff0c;如何让我们的电脑“健康长寿”&#xff0c;陪伴我们更久呢&#xff1f;今…...

Github 2025-05-30Java开源项目日报Top10

根据Github Trendings的统计,今日(2025-05-30统计)共有10个项目上榜。根据开发语言中项目的数量,汇总情况如下: 开发语言项目数量Java项目10C++项目1TypeScript项目1Keycloak: 现代应用程序和服务的开源身份和访问管理解决方案 创建周期:3846 天开发语言:Java协议类型:Ap…...

TypeScript 针对 iOS 不支持 JIT 的优化策略总结

# **TypeScript 针对 iOS 不支持 JIT 的优化策略总结** 由于 iOS 的 **JavaScriptCore (JSC)** 引擎 **禁用 JIT&#xff08;Just-In-Time 编译&#xff09;**&#xff0c;JavaScript 在 iOS 上的执行性能较差&#xff0c;尤其是涉及动态代码时。 **TypeScript&#xff08;T…...

深度剖析Node.js的原理及事件方式

早些年就接触过Node.js&#xff0c;当时对于这个连接前后端框架就感到很特别。尤其是以独特的异步阻塞特性&#xff0c;重塑了了服务器端编程的范式。后来陆陆续续做了不少项目&#xff0c;通过实践对它或多或少增强了不少理解。今天&#xff0c;我试着将从将从原理层剖析其运行…...

基于 Redis 实现分布式锁:原理及注意事项

文章目录 基于 Redis 实现分布式锁&#xff1a;原理及注意事项基于 Redis 实现分布式锁的原理Redis 分布式锁的过期时间和锁续期机制如何防止锁被其他 goroutine 删除&#xff1f;Redis 分布式锁存在的单点故障问题&#xff1a;基于 RedLock 的解决方案高并发场景中 Redis 分布…...