collect_questions
v1.0.0
Published
```````````````````````````````````````````````````````````````` let stdin=process.stdin let stdout=process.stdout const readline=require('readline') `````````````````````````````````````````````````````````````````` `````````````````````````````````
Downloads
4
Readme
let stdin=process.stdin
let stdout=process.stdout
const readline=require('readline')
colors npm i colors
const colors=require('colors')
const rl=readline.createInterface({
input:stdin,
output:stdout
})
let question=['你的姓名','你的性别','你的手机号']
let ind=0
显示输入的问题
rl.setPrompt(`${question[ind]}\n`.rainbow)
命令行输入的东西
rl.prompt()
监听换行事件
rl.on('line',()=>{
if(ind==question.length-1){
rl.close()
}else{
ind++
rl.setPrompt(`${question[ind]}\n`.rainbow
)
rl.prompt()
}
})