美文网首页
全能的判断对象类型的方法

全能的判断对象类型的方法

作者: 阳光之城alt | 来源:发表于2019-01-22 17:45 被阅读0次
image.png

判断对象的类型

export default {
  getTypes: function(instence) {//获取数据类型
    return Object.prototype.toString.call(instence).slice(8, -1);
  }
};
import helper from "./lib/helper.js"
if(helper.getTypes(store.getters.getLoginUser)==="Object"){
    next()
 }

相关文章

网友评论

      本文标题:全能的判断对象类型的方法

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