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

网址注册查询系统临沂seo建站

网址注册查询系统,临沂seo建站,广州最新今天的消息,网站空间去哪买安装/配置: //进入项目目录:(在搭建项目的时候安装了) cnpm install vue-router --save旧版路由 需要自己配置 //项目中载入,一般在main.js中载入:import VueRouter from vue-routerVue.use(VueRouter)let router new VueRouter({}) //其中配置路径和地址//在Vue中引入:n…

安装/配置:

//进入项目目录:(在搭建项目的时候安装了)
cnpm install vue-router --save

旧版路由

需要自己配置
//项目中载入,一般在main.js中载入:import VueRouter from 'vue-router'Vue.use(VueRouter)let router = new VueRouter({})    //其中配置路径和地址//在Vue中引入:new Vue({el: '#app',router,template: '<APP/>',components: { APP }})

新版路由:

自动配置好了,直接在router/index.js中设置即可

设置页面路由

一个vue页面

<template><div class="apple">213124</div>
</template>
<script>
export default {name: 'Apple'
}
</script>
<style scoped>
</style>

旧版

new VueRouter({})所在页面引入:
import Apple from '@/components/Apple'routes: [mode:'history',{path:'/apple',component:Apple},{path:'/apple2',component:Apple2}]

新版

方法1:
const all = r => require.ensure([], () => r(require('../components/attendance/a_all')));
方法2:
const Login =  (resolve) => {require(['@/components/Login/login'],resolve)};{path: '/hdwrj',name: 'hdwrj',component: hdwrj}

在APP.vue中引入

(会在这里显示)

<router-view></router-view>

在这里插入图片描述

路由定义

路由命名

    {path:'/apple',component:Apple,name:'applePage'}
访问:<router-link :to="{name:'applePage'}">to apple</router-link>
命名路由视图

在router-view 上添加name

<router-view name='viewA  '></router-view>

路由表中可以根据name定义页面

    {path:'/apple',component:{viewA:Apple,viewB:OtherApple,},name:'applePage'}

路由嵌套(子路由)

    {path:'/apple',component:Apple,childdren:[{path:'/childapple/',component:ChildApple}]},

内容要在Apple.vue中添加

<router-view></router-view>

页面跳转:

在这里插入图片描述

路由跳转

页面内跳转router-link

要在 mode:'history', 之下

<router-link :to="{path:'apple'},query: {id:id}">to apple</router-link><router-link :to="{path:'apple2'}">to apple2</router-link>普通页面跳转<router-link :to="{path:'apple'}">to apple</router-link>
基于当前路径跳转<router-link :to="'apple'">to apple</router-link>
根目录:<router-link :to="'/apple'">to apple</router-link>
动态设置:<router-link :to="apple">to apple</router-link>在data中:data(){reurn{apple:'apple'}}
传递参数:<router-link :to="{path:'apple',param:{color:'red'}}">to apple</router-link>可以访问 apple/red(参数)
改变router-link显示样式:<router-link :to="'apple'" tag="li">to apple</router-link>

在链接中设置参数

可以设置多层/apple/:color/:font/....

路由设置:path:'/apple/:color',
页面跳转:http://localhost:8080/apple/red
获取参数:$route.params.color

在?中的参数:query

路由:
{path:'/voucher',name: 'voucher',component: voucher
}传参:
this.$router.push({path:'/xxx',query:{id:id}
})接收参数:
this.$route.query.id

注意:传参是this.$router,接收参数是this.$route,这里千万要看清了!!!

  • $router为VueRouter实例,想要导航到不同URL,则使用$router.push方法
  • $route为当前router跳转对象,里面可以获取name、path、query、params等

在json中的参数:params

路由:
{path: '/startWh',name: 'startWh',component: startWh
}
传参:
this.$router.push({name:'xxx'params:{id:id}
})接收参数:
this.$route.params.id

注意:params传参,push里面只能是 name:'xxxx',不能是path:'/xxx',因为params只能用name来引入路由,如果这里写成了path,接收参数页面会是undefined!!!

query和params区别

  • query相当于get请求,页面跳转的时候,可以在地址栏看到请求参数,
  • params相当于post请求,参数不会再地址栏中显示

js中定义导航,跳转

router.push('apple') //或 {path:'apple'}this.$router.push('/login');

路由重定向

比如默认页面是具体的某一个页面,比如访问根目录,会自动跳转到Apple.vue目录

  {path:"/",redirect:'/apple'},

页面跳转–过渡

  <transition name='fff'><keep-alive><!--缓存--><router-view></router-view></keep-alive></transition>
http://www.hkea.cn/news/10534/

相关文章:

  • 番禺的互联网公司衡阳网站优化公司
  • 自己买服务器做网站百度app手机版
  • wordpress插件团购蜘蛛seo超级外链工具
  • 怎么设置微信公众号seo关键词找29火星软件
  • 有哪些网站可以做问卷调查推广赚钱的软件
  • 网上做批发的网站seo实战指导
  • 淮安营销型网站建设最好的网站优化公司
  • 江苏兴力建设集团有限公司网站网络营销策划方案范文
  • 代做网站修改维护广告推广的软件
  • 徐州模板建站系统百度资源搜索平台官网
  • 哪些软件可以做网站线下推广100种方式
  • 高品质网站开发搜索热词排名
  • 平台式网站模板下载地址seo营销策划
  • 深圳网站论坛建设淘宝引流推广怎么做
  • 杭州模板网站建设腾讯云域名
  • 东软 网站群平台建设足球排名世界排名
  • 外贸企业公司网站建设十大培训机构教育培训机构哪家好
  • 橙子官方网站济源网络推广
  • 制作网站报价成都百度网站排名优化
  • 网站如何做超链接广州seo黑帽培训
  • typecho 和WordPress站长工具seo综合查询是什么
  • 有没有专业做特产的网站seo发帖工具
  • 登封建设局网站广告营销推广方案
  • 网站备案很麻烦吗微信营销推广
  • 做网站主页网站搜索引擎优化工具
  • 有些人做网站不用钱的 对吗北京搜索引擎优化
  • 网站建设装什么系统长沙专业做网站公司
  • 易语言怎么做ifa网站填表营销型网站建设推荐
  • python新手代码seo教程seo官网优化详细方法
  • 成都疫情今天最新规定重庆seo优化推广