let segmentedControl: UISegmentedControl = {
let sc = UISegmentedControl(items: ["Inventory", "Sale", "Expense"])
sc.selectedSegmentIndex = 0
sc.layer.cornerRadius = 9
sc.layer.borderWidth = 1
sc.layer.borderColor = UIColor.lightGray.cgColor
sc.layer.masksToBounds = true
sc.frame = CGRect(origin: CGPoint(x: 10, y: 280), size: CGSize(width: 300, height: 30))
sc.addTarget(self, action: #selector(handleSegmentChange), for: .valueChanged)
return sc
}()
答案 0 :(得分:1)
res是对象响应,它包含您在完成响应后将关闭的大量工具和数据。
检查节点API doc
将res()
替换为res.end()
或渲染:
exports.signup_submit = function(req,res){
console.log(req.body.username,"------------------");
var sql = "INSERT INTO customers (username) VALUES (req.body.username)";
con.query(sql, function (err, result, fields) {
if (err) {
return res.render(__dirname + '/views/error.html');
}
res.render(__dirname + '/views/success.html');
});
答案 1 :(得分:0)
您需要使用“ res.send”或“ res.render” 如果您在模板上的错误中有特殊的位置,则可以使用“ res.render(path_to_template,error)”
您可以详细了解here