微信小程序—如何获取用户输入文本框的值k.detail.value

1、前端

1
2
3
4
5
6
7
<view>
<view>
<textarea class="text " bindinput="change" placeholder="请输入你想说的话......字数200字以内 "></textarea>
</view>

<button bindtap="submit" class="btn btn-success block ">提交评价</button>
</view>

2、后端js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* 评价内容
*/
change: function (k) {

console.log('change');
console.log(k.detail.value);
var b = k.detail.value; //这里就是取得的值
var t =this;
t.setData({
content:b
})

},
submit: function () {
console.log('submit');
var t = this;
var order_id = t.data.deviceinfo.id;
console.log(order_id);
var goodsid = t.data.deviceinfo.device_id;
var storeid = t.data.deviceinfo.storeid;
var tagids = t.data.tagids;
var level = t.data.level;
var content = t.data.content;
e.get("store.order_comment", { order_id: order_id, goodsid: goodsid, storeid: storeid, tagids: tagids, level: level, content: content}, function (k) {
0 != k.error && e.toast(t.message, "loading"),
wx.navigateBack("/pages/shareservice/servicedetail/index")
}, true)
},

console打印结果