// pages/xiebiji/xiebiji.js Page({ /** * 页面的初始数据 */ data: { title:"", text:"", content:"", create_time:"", }, contentFs(e){ this.setData({ text: e.detail.text, content: e.detail.html }) }, titletFs(e){ this.setData({ title:e.detail.value }) }, xieFs(){ this.setData({ create_time:new Date().toLocaleString() }) wx.cloud.database().collection("note").add({ data:{ title:this.data.title, text:this.data.text, content:this.data.content, create_time:this.data.create_time, type:1, Collection:0 }}).then(res=>{ wx.switchTab({ url: '/pages/index/index', }) }).catch(res=>{ console.log("type=1 的笔记写入失败",res); }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })