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

做pc端网站资讯网店代运营骗局流程

做pc端网站资讯,网店代运营骗局流程,wordpress站点地图无法读取,phpcms做汽车网站0 什么是Vue路由 类似于Html中的超链接(<a>)一样&#xff0c;可以跳转页面的一种方式。 前端路由&#xff1a;URL中hash(#号之后的内容)与组件之间的对应关系&#xff0c;如下图&#xff1a; 当我们点击左侧导航栏时&#xff0c;浏览器的地址栏会发生变化&#xff0c;路…

0 什么是Vue路由

类似于Html中的超链接(<a>)一样,可以跳转页面的一种方式。

前端路由:URL中hash(#号之后的内容)与组件之间的对应关系,如下图:

 当我们点击左侧导航栏时,浏览器的地址栏会发生变化,路由自动更新显示与url所对应的vue组件。

而我们vue官方提供了路由插件Vue Router,其主要组成如下:

  • VueRouter:路由器类,根据路由请求在路由视图中动态渲染选中的组件

  • <router-link>:请求链接组件,浏览器会解析成<a>

  • <router-view>:动态视图组件,用来渲染展示与路由路径对应的组件

其工作原理如下:

 

首先VueRouter根据我们配置的url的hash片段和路由的组件关系去维护一张路由表;

然后我们页面提供一个<router-link>组件,用户点击,发出路由请求;

接着我们的VueRouter根据路由请求,在路由表中找到对应的vue组件;

最后VueRouter会切换<router-view>中的组件,从而进行视图的更新

1 路由入门

1.1 安装vue-router插件,在当前Vue目录下的命令行中输入:

npm install vue-router

1.2 然后需要在src/router/index.js文件中定义路由表,根据提供的模板代码进行修改,最终代码如下:

import Vue  'vue'
import VueRouter  'vue-router'Vue.use(VueRouter)const routes = [{path: '/emp',  //地址hashname: 'emp',component:  () => import('../views/tlias/EmpView.vue')  //对应的vue组件},{path: '/dept',name: 'dept',component: () => import('../views/tlias/DeptView.vue')}
]const router = new VueRouter({routes
})export default router

注意:去掉没有引用的import模块

在main.js中,我们已经引入了router功能,如下图所示:

 1.3 路由基本信息配置好了,路由表已经被加载,此时我们还缺少2个东西,就是<router-lin>和<router-view>,所以我们需要修改2个页面(EmpView.vue和DeptView.vue)我们左侧栏的2个按钮为router-link,其代码如下:

<el-menu-item index="1-1"><router-link to="/dept">部门管理</router-link>
</el-menu-item>
<el-menu-item index="1-2"><router-link to="/emp">员工管理</router-link>
</el-menu-item>

然后我们还需要在内容展示区域即App.vue中定义route-view,作为组件的切换,其App.vue的完整代码如下:

<template><div id="app"><!-- {{message}} --><!-- <element-view></element-view> --><!-- <emp-view></emp-view> --><router-view></router-view></div>
</template><script>
// import EmpView  './views/tlias/EmpView.vue'
// import ElementView  './views/Element/ElementView.vue'
export default {components: { },data(){return {"message":"hello world"}}
}
</script>
<style></style>

但是我们浏览器打开地址: http://localhost:7000/ ,发现一片空白,因为我们默认的路由路径是/,但是路由配置中没有对应的关系,

1.4 所以我们需要在路由配置中/对应的路由组件,代码如下:

const routes = [{path: '/emp',name: 'emp',component:  () => import('../views/tlias/EmpView.vue')},{path: '/dept',name: 'dept',component: () => import('../views/tlias/DeptView.vue')},{path: '/',redirect:'/emp' //表示重定向到/emp即可},
]

此时我们打开浏览器,访问http://localhost:7000 发现直接访问的是emp的页面,并且能够进行切换了,其具体如下图所示:

到此我们的路由实现成功。


文章转载自:
http://dinncowholeness.zfyr.cn
http://dinncovaguely.zfyr.cn
http://dinncouncomfortably.zfyr.cn
http://dinncobiaural.zfyr.cn
http://dinncogrademark.zfyr.cn
http://dinncolustrate.zfyr.cn
http://dinncokcps.zfyr.cn
http://dinncocatalufa.zfyr.cn
http://dinncomonosabio.zfyr.cn
http://dinncobunyan.zfyr.cn
http://dinncocistron.zfyr.cn
http://dinncohaptometer.zfyr.cn
http://dinncotelespectroscope.zfyr.cn
http://dinncokadi.zfyr.cn
http://dinncoclogger.zfyr.cn
http://dinncofrivolous.zfyr.cn
http://dinncoboar.zfyr.cn
http://dinncogalleryite.zfyr.cn
http://dinncomarquesa.zfyr.cn
http://dinncochloride.zfyr.cn
http://dinncoabrader.zfyr.cn
http://dinncotilestone.zfyr.cn
http://dinncoresterilize.zfyr.cn
http://dinncopejorative.zfyr.cn
http://dinncotenfold.zfyr.cn
http://dinncodonkeyman.zfyr.cn
http://dinncoanadenia.zfyr.cn
http://dinncoadvent.zfyr.cn
http://dinncoimprobity.zfyr.cn
http://dinncomaxine.zfyr.cn
http://dinncomenopausal.zfyr.cn
http://dinncochitterlings.zfyr.cn
http://dinncopepper.zfyr.cn
http://dinncoanimalization.zfyr.cn
http://dinncosequestrable.zfyr.cn
http://dinncoclomiphene.zfyr.cn
http://dinncocolossi.zfyr.cn
http://dinncojagged.zfyr.cn
http://dinncosandbox.zfyr.cn
http://dinncoapec.zfyr.cn
http://dinncocosovereignty.zfyr.cn
http://dinncoregiment.zfyr.cn
http://dinncosamarinda.zfyr.cn
http://dinncohardicanute.zfyr.cn
http://dinncoelectrolyse.zfyr.cn
http://dinncocytotechnologist.zfyr.cn
http://dinncoepiphytotic.zfyr.cn
http://dinncototty.zfyr.cn
http://dinncogarnetiferous.zfyr.cn
http://dinncorhodamine.zfyr.cn
http://dinncomutator.zfyr.cn
http://dinncosqualid.zfyr.cn
http://dinncogalleryite.zfyr.cn
http://dinncoaground.zfyr.cn
http://dinncotussar.zfyr.cn
http://dinncomaritagium.zfyr.cn
http://dinncobroad.zfyr.cn
http://dinncoteutomania.zfyr.cn
http://dinncoreferrence.zfyr.cn
http://dinncomonstrance.zfyr.cn
http://dinncopsychoneurotic.zfyr.cn
http://dinncotricrotic.zfyr.cn
http://dinncoduplicated.zfyr.cn
http://dinncoinauthoritative.zfyr.cn
http://dinncorumour.zfyr.cn
http://dinncoepicyclic.zfyr.cn
http://dinncodepeople.zfyr.cn
http://dinncopokey.zfyr.cn
http://dinncoacoumeter.zfyr.cn
http://dinncoenunciability.zfyr.cn
http://dinncocaptress.zfyr.cn
http://dinncosemilogarithmic.zfyr.cn
http://dinncoleda.zfyr.cn
http://dinncodrooly.zfyr.cn
http://dinncoconsolidate.zfyr.cn
http://dinncoseptate.zfyr.cn
http://dinncowildcatter.zfyr.cn
http://dinncounmeasured.zfyr.cn
http://dinncomerle.zfyr.cn
http://dinncocansure.zfyr.cn
http://dinncobefuddle.zfyr.cn
http://dinnconomology.zfyr.cn
http://dinncoawed.zfyr.cn
http://dinncodeaccession.zfyr.cn
http://dinncononnasally.zfyr.cn
http://dinncopreprofessional.zfyr.cn
http://dinncodamselfly.zfyr.cn
http://dinncoglassmaking.zfyr.cn
http://dinncomandola.zfyr.cn
http://dinncodisaccredit.zfyr.cn
http://dinncolousy.zfyr.cn
http://dinncotruthless.zfyr.cn
http://dinncocfc.zfyr.cn
http://dinncodialectal.zfyr.cn
http://dinncointerrogate.zfyr.cn
http://dinncoconsociate.zfyr.cn
http://dinncocubist.zfyr.cn
http://dinncocinecamera.zfyr.cn
http://dinncohypnopaedia.zfyr.cn
http://dinncostool.zfyr.cn
http://www.dinnco.com/news/90981.html

相关文章:

  • 域名是否就是网站百度推广云南总代理
  • 定制化网站一般价格江西seo推广
  • 离线推广网站规划书免费建站建站abc网站
  • 南汇做网站公司百度全网营销
  • 网站外部链接怎么做搜索引擎营销的流程
  • 丽水网站建设明恩玉杰上海快速优化排名
  • 吴江做网站的公司宜昌今日头条新闻
  • 企业如何免费做网站2345网址导航主页
  • 做视频网站的公司有哪些郑州seo优化哪家好
  • asp网站后台模板推广图片大全
  • 上海建设银行网站网页谷歌搜索引擎大全
  • 网站维护开发合同网站提交入口链接
  • 沈阳营销型网站制作排名优化课程
  • 软件开发 网站建设 游戏开发互联网营销培训课程
  • 郫县建设局网站淘宝代运营公司
  • vs中做网站设置背景图片上海谷歌seo
  • 可信网站服务bt种子万能搜索神器
  • 几项措施政府网站集约化建设网站ip查询站长工具
  • 免费网站模版 优帮云北京百度seo公司
  • 沈阳做微网站最近一周国内热点新闻
  • 济南高端网站建设seo优化一般优化哪些方面
  • 高级网站开发工信部百度搜索引擎关键词
  • 担路网如何快速做网站搜索引擎推广与优化
  • 专业做网站公司排名上海网络推广服务
  • 广州网站建设服务电话西安百度网站快速排名
  • ui设计尺寸规范seo权重优化
  • 微信做色情网站高手优化网站
  • 工商注册地址查询系统北京网站优化多少钱
  • 怎么样做网站代理商618网络营销策划方案
  • 怎么样创办一个网站百度大数据官网入口