• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

微信小程序项目快速搭建模板

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

1.页面浏览

2.目录结构

3.底部导航栏app.json

{
  "pages": [
    "pages/index/index",
    "pages/me/me",
    "pages/logs/logs",
    "pages/details/text"
  ],
  "window": {
    "backgroundTextStyle": "light",
    "navigationBarBackgroundColor": "#fff",
    "navigationBarTitleText": "绿色小程序",
    "navigationBarTextStyle": "black"
  },
  "sitemapLocation": "sitemap.json",
  "tabBar": {
    "list": [
      {
        "pagePath": "pages/index/index",
        "text": "首页",
        "selectedIconPath": "pages/static/1.png",
        "iconPath": "pages/static/1.png"
      },
      {
        "pagePath": "pages/logs/logs",
        "text": "日志",
        "selectedIconPath": "pages/static/2.png",
        "iconPath": "pages/static/2.png"
      },
      {
        "pagePath": "pages/me/me",
        "text": "我的下载",
        "selectedIconPath": "pages/static/3.png",
        "iconPath": "pages/static/3.png"
      }
    ],
    "color": "#000",
    "selectedColor": "#8B4513"
  }
}

4.首页页面代码

<!--index.wxml-->
<swiper indicator-dots="{{indicatorDots}}"
class='swiper'
        autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
      <block wx:for="{{imgUrls}}">
        <swiper-item>
           <navigator url="{{item.link}}" hover-class="navigator-hover">
            <image src="{{item.url}}" class="slide-image"/>
           </navigator> 
        </swiper-item>
      </block>
</swiper>
<view class='tip'>
【最新公告】某某某xxxxxxxxxxxxxx!
</view>



<view wx:for="{{dataList}}" class='p' bindtap='go'>
  <view class='c'>
    <view>标题:{{item.title}} </view>
    <view>内容:{{item.text}}</view>
  </view>
</view>

5.首页样式

/**index.wxss**/
.tip{
  width: 95%;
  height: 1rem;
  background-color: gold;
  border-radius: 20px;
  margin-left: 10px;
  margin-right: 10px;
  margin-bottom: 5px;
  color: white;
  font-size: 12px;
  margin-top: 10px;
}


.slide-image{
  width: 100%;
  /* border-radius: 20px; */
}

.p{
  margin: 12px;
  border: 1px dotted green;
  box-shadow: 2px 2px 2px 2px greenyellow;
  opacity: 0.9;
}

.c{
  padding: 12px;
}

6.首页js

//test.js
//获取应用实例
var app = getApp()
Page({
  data: {
    imgUrls: [
      {
        link: '/pages/index/index',
        url: 'http://img3.imgtn.bdimg.com/it/u=1055727654,337004439&fm=26&gp=0.jpg'
      }, {
        link: '/pages/logs/logs',
        url: 'http://img0.imgtn.bdimg.com/it/u=2491628779,833858759&fm=11&gp=0.jpg'
      }, {
        link: '/pages/logs/logs',
        url: 'http://img0.imgtn.bdimg.com/it/u=745010934,1678154736&fm=11&gp=0.jpg'
      }
    ],
    indicatorDots: true,
    autoplay: true,
    interval: 5000,
    duration: 1000,
    userInfo: {},

    dataList:[
      {
        id:0,
        title:"绿色环保,冲我做起1",
        text:"喵喵喵喵"
      },
       {
        id: 1,
        title:"绿色环保,冲我做起2",
        text:"喵喵喵喵"
      },
       {
        id: 2,
        title: "绿色环保,冲我做起3",
        text: "喵喵喵喵"
      },
      {
        id: 3,
        title: "绿色环保,冲我做起3",
        text: "喵喵喵喵"
      },
      {
        id: 4,
        title: "绿色环保,冲我做起3",
        text: "喵喵喵喵"
      }
    ]

  },
  onLoad: function () {
    console.log('onLoad test');
  },
  go:function(){
    wx.navigateTo({
      url: '../details/text',
      success: function(res) {},
      fail: function(res) {},
      complete: function(res) {},
    })
  }
})

其他页面均为空,本教程只为了快速的搭建个微信小程序项目


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
1-3 微信小程序框架结构发布时间:2022-07-18
下一篇:
小程序页面全局背景颜色设置发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap