15年软件开发经验 只做源码定制 互联网+定制化解决方案

15年软件开发经验,只做源码定制!

原创设计 定制开发

满足您的个性化需求

当前位置:首页 前端开发 vue/vuex

uni-app中的路由

李家霖| 发布于 2021-07-01 21:47:41| 765阅读| 0点赞| 0评论
举报

uni-app中并不能使用vue-router来进行页面路由配置 uni-app中的路由的配置是在项目目录下的pages.json文件下进行配置

uni-app中并不能使用vue-router来进行页面路由配置    

uni-app中的路由的配置是在项目目录下的pages.json文件下进行配置

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQMAAAEECAIAAACjtsYkAAAACXBIWXMAABJ0AAASdAHeZh94AAAaZUlEQVR42u2da3BU53nH8ZdMMpkm7tR2EncySTsdTxJn0nzIh7Rx3cRucNs0dTqxZ9pxHWfaYJDtYLsBA5EBEyww4LGxwVgGg8HcJEBCV0CwAkkrLbrf75fVSqvV/S50WSGgz+67e/Y9Z8979uxF2tt/5jeMtJezy+r5nfd5zznvf1dZxhoUdI/WdfWXdvWV6KSzv9QyWu+9HQCiiFX4CACACQDABABgAgAwAQA1E+4tDgIAYAIAMAEAmAAATAAAJgAAEwBYORPu2vtvjdZN2kp5pgYrlmZ78HGDODLh9qyl4ca+wrMv8hSff9nacCHILZuSHludlC28a01yb2DbdD9RcyPVKWuErw5ggl4TiKKUtcPd+ffsA5FkgrO+YQLQaUKJ4UStKS1IE4jSzDfGe40Lk60yptt16rEcY4LujcAEmLA42FaXd/zAHyqNqUGaoEpZ1mb7dCdMANHRHXU2Go4f2FBWcObe4kB4Teg99fzqJx9zkmhSFLE5OcF1F1+12XuefCzhVLXPuYHShMLE1Z6tJStN4F+LexbbiIm9yTXJ5c4f9hQO8m8GRkX3PKG7peDEwY0mw0ltGZbXBE9NO0uKL2K+Ip1lyj/SbxOcGkgV7Nq+VMGOe59PMQsmG/Ja5zaLgSVmTPhog8nweThN4Pa+zsHBNSw4688zRMjvDcAE5VPkRez4mdvNM/FcYni/E2lr/BsG0dsd5Tu6oxunw94d3ROZoGjxPb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FrDbktdyjK8ekTn+IL4MmFmqLo8e0tT0X7qjtSmzn225syqy9tnxxrwNwCxbEJnxVFqilhHRLv/uYkm6a658cb20sMVOX+k3gl/ABDbJgw0Fb5flrX57oKN3TLUmddqOlR1aXudYTfNDcxVn9t1HUVVhqYog7cEGaPieYIo9tRzu6/YUx/BqQAmyOhvyy25sH52VNb8jFuNM8M1/mzHlwmCjFGBCVpJpp5XMSenFIoe7Ds4FcAE+UxgwWZryarMfXPEcj2I7fgyQZAxqm6C+rp+QeyF6oNDlgwA4ukoKk0PBjuu1Bl2WZvSF6baHacRptruuPul0JggyA4SjAm6k0xFD9YRnApggjoLU62lGRvqr+/trj3dbDzQUX7MPt0RJhM8pe8jyVT0YI0bAUzQGBNGuvNpomxtTGsq+uD2rGVprvfWSE1fc8adeasfZwa4cg+BCdzcQJRkKn6wrxsBTPDWYKjzSk3en2iKfGuktqnw/aVZCzuTMNiZx37We7ZYlobtrwncTFp3kqnjZ9UHC7YAYIKQufGmytytY71GGgfabiabq06QG3T7/GTLRJ/Jnysfue+PSsr2f0zwSjX1mWSq+WDhFgBMEJjQSCZUX9lRey2poWDf/ESzdGE2UwKAOJknDIz3Gi21Z52zAhs+aID1CQDABABgAgAwAQCYAABMAAAmAAATAIhy/h96z7RNj4ToaQAAAABJRU5ErkJggg==

打开后在pages数组中进行配置   

"pages": [ //pages数组中第一项表示应用启动页,参考:https://<a href="https://www.qinfenniao.com/article.html?name=uni" target="_blank">uni</a><a href="https://www.qinfenniao.com/nav/%E7%BD%91%E7%AB%99%E5%BC%80%E5%8F%91.html" target="_blank">app</a>.dcloud.io/collocation/pages
		/*数组的第一项会默认显示*/
		{
			// path设置路径在pages文件夹目录下的vue文件    路径文件不用加后缀名
			"path": "pages/index/index",
			
			// 该页面的窗口的样式
			"style": {
				// 单个页面的样式 会覆盖掉默认的总体样式
				"navigationBarTitleText": "<a href="https://www.qinfenniao.com/article.html?name=uni" target="_blank">uni</a>-<a href="https://www.qinfenniao.com/nav/%E7%BD%91%E7%AB%99%E5%BC%80%E5%8F%91.html" target="_blank">app</a>"
			}
		},<br/><br/>        /*可以配置多个路由*/
		{
			"path":"pages/map/map",
			"style":{
				"navigationBarTitleText":"地址"
			}
		}
	],

当路由配置好后有两种办法来控制路由的跳转

使用代码进行跳转

<a href="https://www.qinfenniao.com/article.html?name=uni" target="_blank">uni</a>.navigateTo({        // url 后跟的字符串是指的跳转路径   文件不用加后缀名
		url:"/pages/userskip/dizhi",
	})

使用标签来进行跳转


      // url 后的字符串是跳转路径   文件不用加后缀名<br/> <navigator url="/pages/userskip/dizhi">        <button type="default">跳转到新页面</button>
 </navigator>





0

0条评论

别默默看啦~登录/注册一起参与讨论吧~

热门标签

李家霖
微信扫一扫立即咨询
账号登录|扫码登录

立即注册 |忘记密码?

欢迎注册

已有账号马上登录

重置密码

扫码绑定微信
微信扫一扫

绑定手机号

分享到-微信

举报

  • 举报类型:

  • 举报描述:

您好,当前积分不足。

在线客服
拨打电话
17330196230 13230981129
顶部