鍍金池/ 問(wèn)答/HTML/ 為什么我在JavaScript中使用了EL語(yǔ)法,但不顯示呢?(已經(jīng)設(shè)置了webs

為什么我在JavaScript中使用了EL語(yǔ)法,但不顯示呢?(已經(jīng)設(shè)置了webstorm能識(shí)別ELS6語(yǔ)法的了)

為什么我在JavaScript中使用了EL語(yǔ)法,但不顯示呢?(已經(jīng)設(shè)置了webstorm能識(shí)別ELS6語(yǔ)法的了)

我的JS代碼如下:
const http=require('http');
const query=require('querystring');
http.createServer(function (req, res) {

var str=' ';//接受數(shù)據(jù)
var  i=0;
req.on('data',function (data) {//有一段數(shù)據(jù)到達(dá)就發(fā)送一次
    console.log('第${i++}次收到數(shù)據(jù)');
    str+=data;
});
req.on('end',function () {//全部到達(dá),只發(fā)一次
    var post=query.parse(str);
    console.log(post);
});

}).listen(8080);

HTML代碼如下:<!DOCTYPE html>
<html lang="en">
<head>

<meta charset="UTF-8">
<title>Form</title>

</head>
<body>
<form action="http://localhost:8080" method="post">

<input type="text" name="user" value=""><br>
<input type="password" name="pass" value="" ><br>
<textarea name="content" rows="8" cols="40"></textarea>
<input type="submit" value="提交">

</body>
</html>

顯示結(jié)果如下:
${i++}次收到數(shù)據(jù)
{ ' user': '234', pass: '234', content: '' }

回答
編輯回答
苦妄

es6模板字符串 是`` tab鍵上邊那個(gè) 不是單引號(hào)

2018年7月17日 05:34