Submit js:openGroup...">
美文网首页
微信小程序获取formId

微信小程序获取formId

作者: LIsPeri | 来源:发表于2018-01-02 15:56 被阅读0次

    wxml:
    <form bindsubmit='openGroupSubmit' report-submit='true'>
    <view class="btn-area">
    <button formType="submit">Submit</button>
    </view>
    </form>

    js:
    openGroupSubmit: function (e) {
    let formId = e.detail.formId;
    if ('the formId is a mock one' == formId) {
    return;
    }
    // this.dealFormIds(formId);
    var nowDate = new Date();
    var month = nowDate.getMonth() + 1;
    var date = nowDate.getDate();
    if (month < 10) {
    month = '0' + month;
    }
    if (date < 10) {
    date = '0' + date;
    }
    let formIds = app.globalData.formIds;
    if (!formIds) formIds = [];
    let data = {
    formId: nowDate.getFullYear() + '-' + month + '-' + date + '_' + formId,
    expire: parseInt(new Date().getTime() / 1000) + 604800
    }
    formIds.push(data);
    app.globalData.formIds = formIds;
    console.log(formIds);
    let type = e.detail.target.dataset.type;
    },

    相关文章

      网友评论

          本文标题:微信小程序获取formId

          本文链接:https://www.haomeiwen.com/subject/sqxqnxtx.html