微信小程序笔记2

2019/04/17
1.第一个界面
<!--index.wxml-->
<view class='main'>
<image src='/images/chimchim.jpg'></image>
<text class='t1'>电影周周看</text>
<view>
<navigator hover-class='nav-hover' style='display:inline;' url='/pages/weekly/weekly' open-type='switchTab'>每周推荐</navigator><text>一部好电影</text>
</view>
<text>我的微博:SUGA‘s Day Ala susu</text>
</view>

open-type=‘redirect’ 在使用了tabbar之后就不能用了
navigator为超链接
hover-class='nav-hover’为鼠标点击链接时的类

/* index.wxss */
image{
  width: 375rpx;
  height: 375rpx;
  border: 3px solid pink;
  border-radius: 50%;
}
.t1{
  font-size: 60rpx;
  font-weight: 800;
}
.nav-hover{
  color: #FF6699;

}
/**app.wxss**/
  .main{
  background:ghostwhite;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
}//弹性布局,为第一个与第二个界面共同的style

在这里插入图片描述

2.第二个界面
<!-- weekly.wxml -->
<view class='main'>
  <text>本周推荐</text>
  <image src='/images/star.jpg'></image>
  <text>A Star Is Born</text>
  <text>SUGA's 推荐,绝对完美</text>
</view>
image{
  width: 200px;
  height: 300px;
}

在这里插入图片描述

3.tabbar的使用

app.json文件内

{
  "pages":[
    "pages/index/index",
    "pages/weekly/weekly"
  ],
  "tabBar":{
    "list":[
      {
        "text":"每周推荐",
        "pagePath":"pages/weekly/weekly",
        "iconPath":"images/流派.png",
        "selectedIconPath":"images/更多.png"
      },
      {
        "text": "关于",
        "pagePath": "pages/index/index",
        "iconPath": "images/我.png",
        "selectedIconPath": "images/云.png"
      }
    ],
    "color": "black",
    "selectedColor": "pink"
  },
  "window":{
    "backgroundTextStyle":"light",
    "navigationBarBackgroundColor": "#FF6699",
    "navigationBarTitleText": "YIHUA",
    "navigationBarTextStyle":"white"
  }
}

必须有"pages"才能显示页面
“tabBar”:{ “list”:[ 为底部导航栏

在这里插入图片描述

4.配置全局导航栏样式

在app.json中:

 "window":{
    "backgroundTextStyle":"light",
    "navigationBarBackgroundColor": "#FF6699",
    "navigationBarTitleText": "YIHUA",
    "navigationBarTextStyle":"white"
  }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值