app之pages添加跳转页面
简单的页面跳转
<View className='at-row'><View className='at-col' style='z-index:1;position:fixed;top:0rpx'><Navigator url='../login/index' open-type='redirect' hover-class='navigator-hover'>跳转到新页面</Navigator></View></View>
加了一些属性,试了半天也没有试出,还加了一些属性,并手动在 dist /app.json 加了跳转到的目录,还是不行。后来发现需要在 app.js 的 config 的pages 添加需要跳转的目录,否则小程序是不会认的。添加了以后成功了。
注意:添加的时候不要写.js 直接写js 的文件名就好。跳转的src 也不要写后缀 .js
app.js
class App extends Component {config = {pages: ['pages/index/index','pages/login/index'],window: {backgroundTextStyle: 'light',navigationBarBackgroundColor: '#fff',navigationBarTitleText: 'WeChat',navigationBarTextStyle: 'black'}}}
pages/index/index
<View className='at-row'><View className='at-col' style='z-index:1;position:fixed;top:0rpx'><Navigator url='../login/index' open-type='redirect' hover-class='navigator-hover'>跳转到新页面</Navigator></View></View>
