js总是提示我is not a function,帮看看
发布于 6 年前 作者 leicheng 5040 次浏览 来自 问答

check.checkIdNull is not a function;at “pages/query/query” page bindIdcardVerify function

在query.js中也引进了var check = require("…/…/utils/check.js")

query.wxml

<view class=“weui-cell weui-cell_input”>

            <input class=“weui-input” name=“idno” type=“idcard” placeholder=“请输入身份证号” maxlength=“18” bindblur=“bindIdcardVerify” />

</view>

query.js

  bindIdcardVerify: function (e) {//身份证号验证

    if (!check.checkIdNull(e.detail.value)) {

      //if (!check.checkPhoneNum(e.detail.value)) {

      return false

    }

  }

check.js

function checkIdNull(content) {

    return (content && content != null)

}

3 回复

明白了 是在check.js中 没加

module.exports= {

    checkIsNotNull: checkIsNotNull,

    checkPhoneNum: checkPhoneNum,

    isContentEqual: isContentEqual,

    checkIdcard: checkIdcard

}

check.js

都没有对外暴露方法,当然不会成功调用了

什么意思?暴露方法?

回到顶部