fix issue textarea value not work

This commit is contained in:
Kiyan 2017-06-02 10:01:46 +08:00
parent a6a65c8107
commit d7737a9fe1
4 changed files with 11 additions and 7 deletions

View File

@ -1,8 +1,8 @@
{ {
"pages": [ "pages": [
"pages/index/index", "pages/index/index",
"pages/order/show",
"pages/order/quasi", "pages/order/quasi",
"pages/order/show",
"pages/shop/show", "pages/shop/show",
"pages/order/list", "pages/order/list",
"pages/order/content", "pages/order/content",

View File

@ -18,11 +18,15 @@ Page({
*/ */
onLoad: function (options) { onLoad: function (options) {
this.callback = options.callback || 'callback' this.callback = options.callback || 'callback'
var {content} = options var content = options.content
var that = this
if (content) { if (content) {
this.setData({ // fix textarea value not work
setTimeout(function () {
that.setData({
content content
}) })
}, 200)
} }
}, },

View File

@ -2,7 +2,7 @@
<view class="weui-cells weui-cells_after-title"> <view class="weui-cells weui-cells_after-title">
<view class="weui-cell"> <view class="weui-cell">
<view class="weui-cell__bd"> <view class="weui-cell__bd">
<textarea bindinput="onContentInput" value="{{content}}" class="weui-textarea" placeholder="口味, 偏好等要求" style="height: 3.3em" /> <textarea bindinput="onContentInput" auto-focus="true" value="{{content}}" class="weui-textarea" placeholder="口味, 偏好等要求" style="height: 3.3em" />
<view class="weui-textarea-counter">{{content.length}}/{{limit}}</view> <view class="weui-textarea-counter">{{content.length}}/{{limit}}</view>
</view> </view>
</view> </view>

View File

@ -14,7 +14,7 @@ Page({
}, },
onLoad: function (options) { onLoad: function (options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
this.id = options.id || '2853' this.id = options.id || '2859'
this.loadData() this.loadData()
}, },
onReady: function () { onReady: function () {