HBuilder 快速启动小程序

本文介绍了如何下载并使用HBuilderX创建uni-app项目,详细讲解了配置appid、小程序设置以及新建页面的过程。通过实例展示了首页内容的布局、组件应用和点击事件,如跳转到订单列表页面。同时,还展示了pages.js的简单配置,包括页面导航栏的设置。
摘要由CSDN通过智能技术生成


下载HBuilder X

创建项目

在这里插入图片描述

配置appid

在这里插入图片描述

配置小程序

在这里插入图片描述

新建uniapp页面

1.创建目录
2.目录下创建同名vue文件

首页内容 及应用组件 加点击事件 跳转案例

<template>
	<view>
	<image class="my"   @click="toOrderList" src="/static/111.png" lazy-load>
			</image>
		<view class="root-a1" >
			<view class="root-a1-b1"></view>
			<view class="root-a1-b2">
				<view>张三</view>
				<view>18866666667</view>
			</view>
		</view>
		<view>
			
		</view>
		<tabbar class="tabbar">
			
		</tabbar>
	</view>
</template>

<script>
	 import tabbar from '../../components/tabbar.vue';
	export default {
		components:{
			tabbar
		},
		
		data() {
			return {
			tabbar	
			}
		},
		onLoad() {
			uni.hideHomeButton();
		},
		methods: {
			toOrderList(){
				uni.navigateTo({
					url:"/pages/user/order/my-order"
				})
			}
		}
	}
</script>

<style>
.tabbar .c4 {
		color: #00C176;
	}
	.root-a1{
		display: flex;
		background-color: #00C176 ;
		width: 750rpx;
		height: 160rpx;
	}
	.root-a1-b1{
		margin-left: 60rpx;
		margin-top: 30rpx;
		width: 84rpx;
		height: 84rpx;
		border-radius: 42rpx;
		background-color: #ffffff;
	}
	.root-a1-b2{
		margin-left: 30rpx;
		margin-top: 30rpx;
		color: #ffffff;
	}
</style>

pages.js简单设置

{
	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
		{
			"path": "pages/index/index",
			"style": {
				"navigationBarTitleText": "首页",
					"navigationBarTextStyle":"black"
			}
		}
	    ,{
            "path" : "pages/index2fenli/index2fenli",
            "style" :                                                                                    
            {
                "navigationBarTitleText": "分类",
				"navigationBarBackgroundColor": "#F2FFF8",
				"navigationBarTextStyle":"black"

            
        }
		}
        ,{
            "path" : "pages/index3car/index3car",
            "style" :                                                                                    
            {
                "navigationBarTitleText": "购物车",
                "enablePullDownRefresh": false,
				"navigationBarTextStyle":"black"
            }
            
        }
        ,{
            "path" : "pages/index4wode/index4wode",
            "style" :                                                                                    
            {
                "navigationBarTitleText": "",
				"navigationBarBackgroundColor":"#00C176"
                
            }
            
        }
		// ,{
		//     "path" : "pages/index/components/d1"
		   
		    
		// }
    ],
	"globalStyle": {
		"navigationBarTextStyle":"white",
		
				 // "navigationStyle": "custom",
		"navigationBarBackgroundColor": "#ffffff",
		"backgroundColor": "#ffffff"
		

	}
	// "tabBar": {
	//    "color": "#BAB9B9",
	//    "selectedColor": "#00C176",
	//    "borderStyle": "white",
	//    "backgroundColor": "#fff",
	//    "iconWidth":"10px",
	//    "list": [
	//      {
	//       "pagePath": "pages/index/index",
	// 	   //   "pagePath": "pages/text/text",
	//        "text": "首页",
	//        "iconPath": "/static/imgs/tabbar/index.png",
	//        "selectedIconPath": "/static/imgs/tabbar/index2.png"
	//      },
	//      {
	//        "pagePath": "pages/index2fenli/index2fenli",
	//        "text": "分类",
	//        "iconPath": "/static/imgs/tabbar/fenlei.png",
	//        "selectedIconPath": "/static/imgs/tabbar/fenlei2.png"
	//      },
	//      {
	//     "pagePath": "pages/index3car/index3car",
	//     "text": "购物车",
	//     "iconPath": "/static/imgs/tabbar/car.png",
	//     "selectedIconPath": "/static/imgs/tabbar/car2.png"
		
	//      },
		 
	// 	 {
	// 	   "pagePath": "pages/index4wode/index4wode",
	// 	   "text": "我的",
	// 	   "iconPath": "/static/imgs/tabbar/wode.png",
	// 	   "selectedIconPath": "/static/imgs/tabbar/wode2.png"
	// 	 }
	//    ]
	//  }
	
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

虚构的乌托邦

如果可以请打赏鼓励

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值