第一步:主界面代碼
<view >
<form bindsubmit="submit">
<view>
<text>姓名:</text>
<input name="張三" value = "張三"/>
</view>
<view>
<text>性別:</text>
<radio-group name="gender">
<label ><radio value="0" checked>男</radio></label>
<label ><radio value="1" >女</radio></label>
</radio-group>
</view>
<view>
<text>專業(yè)技能</text>
<checkbox-group name = "skills">
<label > <checkbox value="html" checked>HTML</checkbox></label>
<label > <checkbox value="css" >CSS</checkbox></label>
<label > <checkbox value="js" >JS</checkbox></label>
<label > <checkbox value="ps" >PS</checkbox></label>
</checkbox-group>
</view>
<view>
<text>您的意見</text>
<textarea name="opinion" value="測(cè)試"></textarea>
</view>
<button form-type="submit">提交</button>
</form>
</view>
**第二步:css樣式修改
`/**index.wxss**/
.container{
margin: 50prx;
}
view{
margin-bottom: 30rpx;
}
input{
width: 600rpx;
margin-top: 10rpx;
border-bottom: 2rpx solid #ccc;
}
label{
display: inline;
margin: 8rpx;
}
textarea{
width: 600rpx;
height: 100rpx;
margin-top: 10rpx;
border: 2rpx solid #eee;
}`
第三步:安裝環(huán)境
先安裝node.js
node.js官網(wǎng)
進(jìn)入官網(wǎng)安裝穩(wěn)定版本
安裝完畢后在同一級(jí)創(chuàng)建一個(gè)空文件夾 最好都用英文文件夾名
打開新文件夾
打開命令提示符cmd 地址找到新建的文件夾
輸入 npm init -y
再輸入 npm install express --save
用完之后不要關(guān)
會(huì)創(chuàng)建好如圖一個(gè)文件夾 一個(gè)json文件
然后再這個(gè)文件夾內(nèi)創(chuàng)建一個(gè)index.js文件 用記事本打開 輸入內(nèi)容
const express = require('express')
const bodyParser = require('body-parser')
const app = express()
app.use(bodyParser.json())
//處理POSE請(qǐng)求
app.post('/',(req,res) =>{
console.log(req.body)
res.json(req.body)
})
//監(jiān)聽3000端口
app.listen(3000,() =>{
console.log('server running at http://127.0.0.1:3000')
})
打開cmd窗口
輸入 nodemon index.js
出現(xiàn)server running at http://127.0.0.1:3000即為成功
然后回到微信小程序 點(diǎn)擊提交按鈕 打開cmd框回車
出現(xiàn)以下圖示即為成功 項(xiàng)目完成文章來源:http://www.zghlxwxcb.cn/news/detail-489728.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-489728.html
到了這里,關(guān)于微信小程序開發(fā) 案例二 調(diào)查問卷的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!