75 lines
1.7 KiB
Swift
75 lines
1.7 KiB
Swift
//
|
|
// TabbarView.swift
|
|
// copinism
|
|
//
|
|
// Created by 黄仕杰 on 2024/6/4.
|
|
//
|
|
|
|
|
|
// 底部导航栏切换
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct TabbarView: View {
|
|
@Binding var active: Selection
|
|
|
|
var body: some View {
|
|
HStack {
|
|
Spacer()
|
|
|
|
Button {
|
|
active = .home
|
|
} label: {
|
|
Text("首页")
|
|
.SetTextStyle(size: 16, color: active == .home ? .black : .gray)
|
|
}
|
|
|
|
Spacer()
|
|
|
|
Button {
|
|
active = .sopping
|
|
} label: {
|
|
Text("购物")
|
|
.SetTextStyle(size: 16, color: active == .sopping ? .black : .gray)
|
|
}
|
|
|
|
Spacer()
|
|
|
|
// Button {} label: {
|
|
// Image(systemName: "plus")
|
|
// .padding(.horizontal, 12)
|
|
// .padding(.vertical, 6)
|
|
// .foregroundStyle(.white)
|
|
// .background(.red, in: RoundedRectangle(cornerRadius: 8))
|
|
// }
|
|
|
|
Spacer()
|
|
|
|
Button {
|
|
active = .message
|
|
} label: {
|
|
Text("消息")
|
|
.SetTextStyle(size: 16, color: active == .message ? .black : .gray)
|
|
}
|
|
|
|
Spacer()
|
|
|
|
Button {
|
|
active = .mine
|
|
} label: {
|
|
Text("我")
|
|
.SetTextStyle(size: 16, color: active == .mine ? .black : .gray)
|
|
}
|
|
|
|
Spacer()
|
|
}
|
|
.foregroundStyle(.black)
|
|
}
|
|
}
|
|
|
|
// #Preview {
|
|
// TabbarView()
|
|
// }
|
|
|