微信小程序填空题代码
时间: 2023-10-05 15:11:09 浏览: 130
微信答题小程序源代码.zip
微信小程序填空题代码:
```javascript
// pages/fill_in_the_blanks/fill_in_the_blanks.js
Page({
data: {
sentence: " __________ a day keeps the doctor away.",
answer: "",
result: ""
},
// 获取用户输入答案
getInputAnswer(e) {
this.setData({
answer: e.detail.value
});
},
// 检查答案
checkAnswer() {
if (this.data.answer.toLowerCase() === "apple") {
this.setData({
result: "回答正确!"
});
} else {
this.setData({
result: "回答错误!请重新回答。"
});
}
}
})
```
阅读全文