不同用户进页面访问不同API

解析对象为JSON
 
JSON.parse() .内容    获取相应参数
v-if="flag"

data() {
    return {
      flag:"",
    };
  },


  mounted() {
    // 判断用户或管理员if (JSON.parse(window.localStorage.getItem("user" || "[]")).roleId == 1) {
      this.flag = true;
      console.log(this.flag);
    }
    console.log(window.localStorage.user);
  },

 

posted @ 2022-05-26 18:08  快了星球  阅读(38)  评论(0)    收藏  举报