您当前的位置: 首页 >  ar

【Kevin Learn 小程序】--> navigator

发布时间:2020-02-22 17:31:20 ,浏览量:7

效果图

在这里插入图片描述

属性

参考:navigator

实例 app
  1. app.js
App({ onLaunch: function () { console.log('App Launch') }, onShow: function () { console.log('App Show') }, onHide: function () { console.log('App Hide') }, globalData: { hasLogin: false } }) 
  1. app.json
{ "pages": [ "pages/pageA/navigator", "pages/pageB/navigate", "pages/pageC/redirect", "pages/pageD/pageD" ], "tabBar": { "list": [ { "pagePath": "pages/pageA/navigator", "text": "页面A" }, { "pagePath": "pages/pageD/pageD", "text": "页面D" } ] }, "window": { "backgroundTextStyle": "light", "navigationBarBackgroundColor": "#fff", "navigationBarTitleText": "WeChat", "navigationBarTextStyle": "black" } } 
  1. app.wxss
{ "description": "项目配置文件",
	"packOptions": { "ignore": [] },
	"setting": { "urlCheck": true, "es6": true, "postcss": true, "minified": true, "newFeature": true, "autoAudits": false, "coverView": true, "showShadowRootInWxmlPanel": true, "scopeDataCheck": false },
	"compileType": "miniprogram",
	"libVersion": "2.10.2",
	"appid": "wx8c507272cc079a6a",
	"projectname": "navigator",
	"debugOptions": { "hidedInDevtools": [] },
	"isGameTourist": false,
	"simulatorType": "wechat",
	"simulatorPluginLibVersion": {},
	"condition": { "search": { "current": -1, "list": [] },
		"conversation": { "current": -1, "list": [] },
		"game": { "currentL": -1, "list": [] },
		"miniprogram": { "current": -1, "list": [] } } } 
pageA
  1. navigator.js
Page({}) 
  1. navigator.json
{ "navigationBarTitleText": "navigator" } 
  1. navigator.wxml
<view class="container"> <view class="page-body"> <view class="btn-area"> <navigator url="../pageB/navigate?title=navigate" hover-class="navigator-hover"> <button type="default">跳转到新页面</button> </navigator> <navigator url="../pageC/redirect?title=redirect" redirect hover-class="other-navigator-hover"> <button type="default">在当前页打开</button> </navigator> <navigator url="../pageD/pageD" open-type="switchTab"> <button type="default">切换tab页面</button> </navigator> <navigator url="/pages/pageA/navigator" open-type="reLaunch"> <button type="default">重加载页面</button> </navigator> </view> </view> </view> 
  1. navigator.wxss
.navigator-hover button{ background-color: #DEDEDE; } .other-navigator-hover button{ background-color: #DEDEDE; } 
pageB
  1. navigate.js
Page({ onLoad: function (options) { console.log(options) } }) 
  1. navigate.json
{ "navigationBarTitleText": "navigate页面" } 
  1. navigate.wxml
<view class="container"> <view> 新的navigate页面 </view> <navigator open-type="navigateBack"> <button type="default">返回页面A</button> </navigator> </view> 
pageC
  1. redirect.js
Page({ onLoad: function (options) { console.log(options) } }) 
  1. redirect.json
{ "navigationBarTitleText": "redirect页面" } 
  1. redirect.wxml
<view class="container"> <view> 重定向页面 </view> </view> 
pageD
  1. navigator.js
Page({}) 
  1. navigator.wxml
<!--pages/pageD/pageD.wxml--> <view class="container"> <view> 页面D </view> </view> 
关注
打赏
1688896170
查看更多评论

暂无认证

  • 7浏览

    0关注

    115984博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0836s