feat(WechatSmallProject): 新增 微信小程序 课程(包含实验1-4)
This commit is contained in:
12
WechatSmallProject/test3/pages/index/index.js
Normal file
12
WechatSmallProject/test3/pages/index/index.js
Normal file
@@ -0,0 +1,12 @@
|
||||
Page({
|
||||
data: {
|
||||
currentTab: 0
|
||||
},
|
||||
|
||||
switchTab(e) {
|
||||
const tab = e.currentTarget.dataset.tab;
|
||||
this.setData({
|
||||
currentTab: parseInt(tab)
|
||||
})
|
||||
}
|
||||
})
|
||||
4
WechatSmallProject/test3/pages/index/index.json
Normal file
4
WechatSmallProject/test3/pages/index/index.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
}
|
||||
}
|
||||
32
WechatSmallProject/test3/pages/index/index.wxml
Normal file
32
WechatSmallProject/test3/pages/index/index.wxml
Normal file
@@ -0,0 +1,32 @@
|
||||
<view class="container">
|
||||
|
||||
<view class="tab-box">
|
||||
<view class="tab tab1 {{currentTab==0?'active':''}}" bindtap="switchTab" data-tab="0">
|
||||
页面1
|
||||
</view>
|
||||
<view class="tab tab2 {{currentTab==1?'active':''}}" bindtap="switchTab" data-tab="1">
|
||||
页面2
|
||||
</view>
|
||||
<view class="tab tab3 {{currentTab==2?'active':''}}" bindtap="switchTab" data-tab="2">
|
||||
页面3
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="content-box">
|
||||
<view wx:if="{{currentTab == 0}}" class="page page1">
|
||||
<view class="title">第 1 个界面</view>
|
||||
<view>对应 Tab1 内容</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{currentTab == 1}}" class="page page2">
|
||||
<view class="title">第 2 个界面</view>
|
||||
<view>对应 Tab2 内容</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{currentTab == 2}}" class="page page3">
|
||||
<view class="title">第 3 个界面</view>
|
||||
<view>对应 Tab3 内容</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
69
WechatSmallProject/test3/pages/index/index.wxss
Normal file
69
WechatSmallProject/test3/pages/index/index.wxss
Normal file
@@ -0,0 +1,69 @@
|
||||
.container {
|
||||
padding: 20rpx;
|
||||
|
||||
}
|
||||
|
||||
.tab-box {
|
||||
display: flex;
|
||||
gap: 10rpx;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.tab {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
padding: 25rpx;
|
||||
font-size: 32rpx;
|
||||
border-radius: 10rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.tab1 {
|
||||
background: #ff7676;
|
||||
}
|
||||
|
||||
.tab2 {
|
||||
background: #56c1fe;
|
||||
}
|
||||
|
||||
.tab3 {
|
||||
background: #62d462;
|
||||
}
|
||||
|
||||
.tab1.active {
|
||||
background: #ff4444;
|
||||
}
|
||||
|
||||
.tab2.active {
|
||||
background: #0099ff;
|
||||
}
|
||||
|
||||
.tab3.active {
|
||||
background: #22cc22;
|
||||
}
|
||||
|
||||
.page {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
border-radius: 12rpx;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.page1 {
|
||||
background: #ff7676;
|
||||
}
|
||||
|
||||
.page2 {
|
||||
background: #56c1fe;
|
||||
}
|
||||
|
||||
.page3 {
|
||||
background: #62d462;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 40rpx;
|
||||
font-weight: bold;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user