This commit is contained in:
2024-12-27 10:59:14 +08:00
parent 09d092fba5
commit 630e14fe1e
4 changed files with 70 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
import {Component} from "react";
import {Slot, View} from "@tarojs/components";
import './index.scss';
import Taro from "@tarojs/taro";
class XNav extends Component {
static defaultProps = {
backgroundColor: '#FFFFFF',
position: 'block',
}
constructor(props) {
super(props);
this.state = {
statusBarHeight: 0,
};
}
componentDidMount() {
const sysInfo = Taro.getSystemInfoSync();
this.setState({ statusBarHeight: sysInfo.statusBarHeight });
}
render() {
const { statusBarHeight } = this.state;
return (
<View class='x-nav-box' style={{
paddingTop: `${statusBarHeight}px`,
backgroundColor: this.props.backgroundColor,
position: this.props.position,
}}>
<View class='cont'>
{ this.props.children }
</View>
</View>
)
}
}
export default XNav;

View File

@@ -0,0 +1,12 @@
.x-nav-box {
//padding-top: v-bind(TopHight);
//background-color: v-bind(backgroundColor);
//position: v-bind(position);
top: 0;
left: 0;
z-index: 999;
@apply w-full;
.cont {
height: 75rpx;
}
}

View File

@@ -0,0 +1,17 @@
import { Component } from 'react'
import { Image } from "@tarojs/components";
class XPageBg extends Component {
static defaultProps = {
src: require('../../static/image/背景@2x.png')
}
render() {
return (
<Image class="w-h-full absolute -z-10" src={this.props.src}></Image>
);
}
}
export default XPageBg;

View File