项目问题

1. 右击弹出框,不点击空白 ,直接点击标签页  在其他标签页会显示弹出框( 在A页面修改了Vuex中状态。需要在B页面实时进行监听 )?

解决: 

由于 Vuex 的状态存储本来就是响应式的,从 store 实例中读取状态最简单的方法,就是在计算属性中返回某个状态。

在 B 页面引入以下代码:

computed: {
    myValue() {
        return this.$store.state.someValue
    }
}

此时,当 A 页面通过某种方式更改了 this.$store.state.someValue 的值,B 页面中 myValue 的值便会自动得到更新。

如果题主所指的监听,是要在这个值变化后触发其他动作,则需要在 B 页面加入侦听属性:

watch: {
    myValue: function(newVal, oldVal) {
        //其他业务代码
    }
}   //根据新旧状态不同实现。

2.对接口时的参数问题

 在vue.config.js里配置反向代理:

  proxy: {
      '/ccc': {
        target: 'https://parrot.xfyun.cn',
        changeOrigin: true,
        pathRewrite:{
          "^/ccc":""
        }
        /* /kerwin/ajax/comingList  ====> /ajax/comingList  */
      },
      
    }

 配置默认请求地址 baseURL

  baseURL: 'https://parrot.xfyun.cn',

  请求数据时要传上后台需要的参数等。

axios.request({
   url:"",
    method:"",
   后台需要传的参数,如userid等 
}).then(res=>{
     console.log("成功") 
    this.data=res.data 
} )

  

  baseURL: 'https://parrot.xfyun.cn',
原文地址:https://www.cnblogs.com/zhouqingfeng/p/13235055.html