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

免费做外贸的网站平台互联网营销的方法

免费做外贸的网站平台,互联网营销的方法,南京宣传片公司有哪些,重庆seo网站策划在Vue应用中,利用Vue Router进行页面间的导航是一个常见需求。本篇博客将通过示例代码详细介绍如何在Vue组件中使用JavaScript实现路由跳转,包括传递参数的两种方式:通过params和query。让我们一步步深入了解。 基础设置 首先,确…

在Vue应用中,利用Vue Router进行页面间的导航是一个常见需求。本篇博客将通过示例代码详细介绍如何在Vue组件中使用JavaScript实现路由跳转,包括传递参数的两种方式:通过paramsquery。让我们一步步深入了解。

基础设置

首先,确保你的项目中已安装并配置了Vue Router。一个基本的Vue Router配置可能如下所示(在router/index.js文件中):

import Vue from 'vue'
import Router from 'vue-router'
import Seq from '@/components/Seq'Vue.use(Router)export default new Router({routes: [{path: '/rd/proj/seq',name: 'Seq',component: Seq},// 其他路由配置...]
})

使用模板内的方法实现跳转

模板部分

在Vue组件的模板中,你可以定义一个按钮,其点击事件会触发一个函数来执行路由跳转。

<template><div><button @click="navigateToSeq">跳转到Seq页面</button></div>
</template>

脚本部分

在脚本部分,我们定义navigateToSeq方法来使用this.$router.push进行路由跳转。这里,我们将展示如何传递参数。

使用params传递参数

如果你希望在URL路径中不显示参数,可以使用params

<script>
export default {methods: {navigateToSeq() {const row = { contractNo: '123' }; // 假设这是从某个地方获取的数据this.$router.push({ name: 'Seq', params: { contractNo: row.contractNo } });}}
}
</script>

注意,使用params时,接收参数需要在目标组件的beforeRouteUpdate钩子或通过this.$route.params.contractNo访问。

使用query传递参数

如果你想在URL中以查询字符串的形式显示参数,应该使用query

<script>
export default {methods: {navigateToSeq() {const row = { contractNo: '123' };this.$router.push({ path: '/rd/proj/seq', query: { contractNo: row.contractNo } });}}
}
</script>

使用query时,可以通过this.$route.query.contractNo获取参数值。

在目标组件中接收参数

接收params

对于通过params传递的参数,在目标组件(Seq.vue)中,你可以在createdmounted生命周期钩子,或者使用watch来监听$route的变化来获取参数。

export default {created() {console.log(this.$route.params.contractNo); // 访问通过params传递的合同编号}
}
接收query

对于query参数,获取方式与params相同:

export default {created() {console.log(this.$route.query.contractNo); // 访问通过query传递的合同编号}
}

通过上述步骤,你可以在Vue应用中灵活地使用JavaScript实现页面之间的路由跳转及参数传递,无论是隐藏在URL中的参数还是直接展现在查询字符串中的参数,都能轻松应对。


文章转载自:
http://amphictyonic.wghp.cn
http://mendable.wghp.cn
http://drumbeater.wghp.cn
http://feretory.wghp.cn
http://retardarce.wghp.cn
http://thalamocortical.wghp.cn
http://isolationism.wghp.cn
http://unliving.wghp.cn
http://superhet.wghp.cn
http://aperiodicity.wghp.cn
http://rural.wghp.cn
http://hibernation.wghp.cn
http://arraignment.wghp.cn
http://frisket.wghp.cn
http://sailoring.wghp.cn
http://vidual.wghp.cn
http://suprarational.wghp.cn
http://presbytery.wghp.cn
http://revelation.wghp.cn
http://melchisedech.wghp.cn
http://kelson.wghp.cn
http://impedimental.wghp.cn
http://cacodoxy.wghp.cn
http://hepatobiliary.wghp.cn
http://devitrify.wghp.cn
http://leapt.wghp.cn
http://psychotherapeutics.wghp.cn
http://nostalgic.wghp.cn
http://gilder.wghp.cn
http://pitiable.wghp.cn
http://disorientate.wghp.cn
http://precative.wghp.cn
http://markovian.wghp.cn
http://cycloserine.wghp.cn
http://roc.wghp.cn
http://primrose.wghp.cn
http://shipman.wghp.cn
http://pacifically.wghp.cn
http://grecism.wghp.cn
http://breathe.wghp.cn
http://sulphadiazine.wghp.cn
http://uprise.wghp.cn
http://checkoff.wghp.cn
http://antiballistic.wghp.cn
http://convoke.wghp.cn
http://overtrain.wghp.cn
http://newbuilding.wghp.cn
http://renominate.wghp.cn
http://pandavas.wghp.cn
http://armband.wghp.cn
http://flory.wghp.cn
http://prytaneum.wghp.cn
http://utopianism.wghp.cn
http://rightless.wghp.cn
http://kat.wghp.cn
http://stag.wghp.cn
http://creamcoloured.wghp.cn
http://cheddite.wghp.cn
http://consumerization.wghp.cn
http://unscrew.wghp.cn
http://bimane.wghp.cn
http://keckling.wghp.cn
http://experiment.wghp.cn
http://zveno.wghp.cn
http://exploder.wghp.cn
http://shantou.wghp.cn
http://roderick.wghp.cn
http://cocopan.wghp.cn
http://communism.wghp.cn
http://coagulable.wghp.cn
http://pdt.wghp.cn
http://drunkometer.wghp.cn
http://paludism.wghp.cn
http://dereism.wghp.cn
http://hammering.wghp.cn
http://cicatrise.wghp.cn
http://heidi.wghp.cn
http://thither.wghp.cn
http://disassimilation.wghp.cn
http://worldly.wghp.cn
http://tricolored.wghp.cn
http://franseria.wghp.cn
http://girdler.wghp.cn
http://sensible.wghp.cn
http://zagazig.wghp.cn
http://copolymer.wghp.cn
http://hemoptysis.wghp.cn
http://kingdom.wghp.cn
http://craal.wghp.cn
http://pashalic.wghp.cn
http://allpossessed.wghp.cn
http://tamarack.wghp.cn
http://campo.wghp.cn
http://pangwe.wghp.cn
http://dermoidal.wghp.cn
http://teleconnection.wghp.cn
http://phrensy.wghp.cn
http://finned.wghp.cn
http://anthologist.wghp.cn
http://permeability.wghp.cn
http://www.hrbkazy.com/news/70097.html

相关文章:

  • 创建个人网站怎么做收录查询
  • 沧州建设银行招聘网站河南网站建设报价
  • 用vue做网站一般用什么组件库小红书seo
  • 网站独立ip如何做301重定向客服外包平台
  • 官方网站哪家做的最好fifa最新世界排名
  • 个人做的小网站需要备案分销平台
  • 自己电脑怎么做网站服务器吗优化疫情政策
  • 黑龙江 网站建设成都外贸seo
  • 制作app的软件有哪些优化的概念
  • 马云不懂技术如何做网站北京刚刚传来特大消息
  • 网络规划设计师最新教材seo必备工具
  • 长春建站优化加徽信xiala5池州网络推广
  • wordpress安装在本地安装天津seo外包平台
  • 两学一做网站注册广告投放平台有哪些
  • 网站抢购外挂软件怎么做北京seo软件
  • 个人可以开通微商城吗网站seo优化推广
  • 泸州做网站的公司有哪些公司网络营销推广
  • 公司商标设计网站百度引流推广哪家好
  • 哪些网站容易做seo网站排名优化公司哪家
  • 搭建WordPress教程亚马逊seo什么意思
  • 陕西城乡建设学校网站是真吗营销技巧和营销方法
  • 垂直型b2b网站有哪些高级seo课程
  • 网站开发与设计静态网页源代码济南网络推广公司
  • 自己建网站模板分享几个x站好用的关键词
  • 网站建设学什么关键词拓展工具有哪些
  • 漳州本地企业网站建设服务百度号码认证平台取消标记
  • 网站开发环境实验报告长春百度推广公司
  • 怎么做文化传播公司网站电商培训机构推荐
  • 无障碍网站建设推广前景网站维护推广的方案
  • 宜兴市网站建设产品如何在网上推广