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

4852919-526e34787741e6bb.png
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()
 }

猜你喜欢

转载自blog.csdn.net/weixin_34245082/article/details/87577561