forked from hzuapps/wechat-miniprogram-hzc-2017
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee5eb00
commit a8fcc9b
Showing
4 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// pages/form/form.js | ||
Page({ | ||
|
||
/** | ||
* 页面的初始数据 | ||
*/ | ||
data: { | ||
text: "Hello" | ||
}, | ||
|
||
/** | ||
* 生命周期函数--监听页面加载 | ||
*/ | ||
onLoad: function (options) { | ||
var that = this; | ||
wx.getStorage({ | ||
key: 'formData', | ||
success: function (res) { | ||
console.log(res.data) | ||
that.setData({ | ||
text: res.data.text, | ||
paragh: res.data.paragh | ||
}); | ||
} | ||
}) | ||
}, | ||
|
||
/** | ||
* 生命周期函数--监听页面初次渲染完成 | ||
*/ | ||
onReady: function () { | ||
|
||
}, | ||
|
||
/** | ||
* 生命周期函数--监听页面显示 | ||
*/ | ||
onShow: function () { | ||
|
||
}, | ||
|
||
/** | ||
* 生命周期函数--监听页面隐藏 | ||
*/ | ||
onHide: function () { | ||
|
||
}, | ||
|
||
/** | ||
* 生命周期函数--监听页面卸载 | ||
*/ | ||
onUnload: function () { | ||
|
||
}, | ||
|
||
/** | ||
* 页面相关事件处理函数--监听用户下拉动作 | ||
*/ | ||
onPullDownRefresh: function () { | ||
|
||
}, | ||
|
||
/** | ||
* 页面上拉触底事件的处理函数 | ||
*/ | ||
onReachBottom: function () { | ||
|
||
}, | ||
|
||
/** | ||
* 用户点击右上角分享 | ||
*/ | ||
onShareAppMessage: function () { | ||
|
||
}, | ||
|
||
doSubmit: function (e) { | ||
console.dir(e) | ||
var that = this; | ||
var text = e.detail.value.text; | ||
var paragh = e.detail.value.paragh; | ||
|
||
wx.setStorage({ | ||
key: "formData", | ||
data: { | ||
text: text, | ||
paragh: paragh | ||
} | ||
}) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!--pages/form/form.wxml--> | ||
<view class="page" xmlns:wx="http://www.w3.org/1999/xhtml"> | ||
<view class="page__hd"> | ||
<view class="page__title">表单示例</view> | ||
<view class="page__desc">输入文字并提交</view> | ||
</view> | ||
<form bindsubmit="doSubmit"> | ||
<view class="page__bd"> | ||
<view class="weui-toptips weui-toptips_warn" wx:if="{{paragh}}">{{text + ", " + paragh}}</view> | ||
|
||
<view class="weui-cells__title">文本框</view> | ||
<view class="weui-cells weui-cells_after-title"> | ||
<view class="weui-cell weui-cell_input"> | ||
<view class="weui-cell__bd"> | ||
<input class="weui-input" placeholder="请输入文本" name="text" value="{{text}}"/> | ||
</view> | ||
</view> | ||
</view> | ||
|
||
<view class="weui-cells__title">文本域</view> | ||
<view class="weui-cells weui-cells_after-title"> | ||
<view class="weui-cell"> | ||
<view class="weui-cell__bd"> | ||
<textarea name="paragh" class="weui-textarea" placeholder="请输入文本" style="height: 3.3em" value="{{paragh}}"/> | ||
<view class="weui-textarea-counter">0/200</view> | ||
</view> | ||
</view> | ||
</view> | ||
|
||
<view class="weui-btn-area"> | ||
<button class="weui-btn" type="primary" formType="submit">确定</button> | ||
</view> | ||
</view> | ||
</form> | ||
</view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* pages/form/form.wxss */ |