index.wxml文件中
<!--index.wxml-->
<view class="custom-navigation">
<view class="nav-title">调查问卷</view>
</view>
<view class="container">
<form bindsubmit="submit">
<view>
<text>姓名:</text>
<input name="name" value="张三"/>
</view>
<view>
<text>性别:</text>
<radio-group name="gender">
<label><radio value="0" checked/>男</label>
<label><radio value="1" />女</label>
</radio-group>
</view>
<view>
<text>专业技能:</text>
<checkbox-group name="skills">
<label><checkbox value="html" checked/>HTML</label>
<label><checkbox value="css" checked/>CSS</label>
<label><checkbox value="js" checked/>JavaScript</label>
<label><checkbox value="ps" checked/>Photoshop</label>
</checkbox-group>
</view>
<view>
<text>您的意见:</text>
<textarea name="opinion" value="测试"/>
</view>
<button form-type="submit">提交</button>
</form>
</view>
index.wxss文件中
/**index.wxss**/
page {
height: 100vh;
display: flex;
flex-direction: column;
}
.custom-navigation {
background-color: #fff;
height:120px; /* 根据需要调整高度 */
display: flex;
align-items: center;
justify-content: center;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 999;
}
.nav-title {
color: black;
font-size: 18px;
}
.scrollarea {
flex: 1;
overflow-y: hidden;
}
.container{margin:50rpx}
view{margin-bottom:30rpx}
input{width: 600rpx;margin-top:10rpx;border-bottom:2rpx solid #ccc}
label{display: block;margin: 8rpx}
textarea{width: 600rpx;height: 100rpx;margin-top:10rpx ;border: 2rpx solid #eee}
在index.json中
{
"navigationBarTitleText": "调查问卷"
}
app.json
{
"pages": [
"pages/index/index"
],
"window": {
"navigationBarTextStyle": "black",
"navigationStyle": "custom",
"navigationBarTitleText": "调查问卷"
},
"style": "v2",
"renderer": "skyline",
"rendererOptions": {
"skyline": {
"defaultDisplayBlock": true,
"defaultContentBox": true,
"tagNameStyleIsolation": "legacy",
"disableABTest": true,
"sdkVersionBegin": "3.0.0",
"sdkVersionEnd": "15.255.255"
}
},
"componentFramework": "glass-easel",
"sitemapLocation": "sitemap.json",
"lazyCodeLoading": "requiredComponents"
}