修改element-ui走马灯按钮样式,outline: none;不生效,scss公共路径的使用,scss的样式继承 @extend,vue在tab切换或页面跳转时取消上次的接口请求

 修改element-ui走马灯按钮样式

 .el-carousel__arrow {
    width: 30px;
    height: 30px;
    top: 55%;
    background-color: transparent;
    .el-icon-arrow-right:before {
      content: none;
    }
    .el-icon-arrow-left:before {
      content: none;
    }
  }
  .el-carousel__arrow--left {
    background: url(../../../images/left-checked.png);
    background-size: 100%;
  }
  .el-carousel__arrow--right {
    background: url(../../../images/right-checked.png);
    background-size: 100%;
  }
}

scss公共路径的使用

$commonUrl: "../../../images/";

background: url($commonUrl+'down.png') no-repeat left center;

但这样有个坏处就是我们无法通过vscode插件看到图标的样子了

VSCode图片预览插件 Image preview

 

 修改按钮文字,修改当前元素内的文字

 <em @click="togglebox($event)">收缩</em>


 togglebox:function(e){
                this.boxshow = !this.boxshow;
				if(this.boxshow==true){
					e.toElement.innerHTML="收缩";
				}else{
					e.toElement.innerHTML="展开";
				}
        },

scss的样式继承 @extend

<style lang="scss" scoped>

.blue {
  cursor: pointer;
  min-width: 80px;
  color: #fff;
  font-size: 14px;
  border-radius: 6px !important;
}

.blues {
  @extend .blue;
  height: 38px;

}
</style>

vue在tab切换或页面跳转时取消上次的接口请求

main.js请求拦截器中写

window._axiosPromiseArr = []; // axios中设置放置要取消的对象
Vue.prototype.$http.interceptors.request.use(config => {
  const token = localStorage.getItem("header");
  if (token) {
    config.headers.Authorization = token;
  }
  // console.log('config的路径,参数 :>> ', config.url,config.data);
 
  if (
    config.url.indexOf("getTradeSetting") > -1 ||
    config.url.indexOf("address/list") > -1 ||
    config.url.indexOf("dic/data_dic") > -1
  ) {
    //配置请求不取消
    return config;
  }
  config.cancelToken = new axios.CancelToken(cancel => {
    window._axiosPromiseArr.push({ cancel });
  });
  return config;
});

router.js路由配置文件中

router.beforeEach((to, from, next) => {
  //匹配元路由中的meta字段,如果设置了需要校验用户信息
  //如果用户本地没有登录状态,跳转到登录页面
  window._axiosPromiseArr.forEach((ele, index) => {
    ele.cancel(); // 路由跳转之前,清空(终止)上一个页面正在请求的内容
    // 清空请求的参数 清空请求的参数
    delete window._axiosPromiseArr[index];
  });
 
});

在具体的vue文件中点击tab切换

toggleTabs() {

    window._axiosPromiseArr.forEach((ele, index) => {
    ele.cancel(); // 路由跳转之前,清空(终止)上一个页面正在请求的内容
    // 清空请求的参数 清空请求的参数
    delete window._axiosPromiseArr[index];
  });}

vscode快捷键

Ctrl + Shift + L或Ctrl+F2全选所有字符-选择当前选择的所有出现 

Ctrl+Shift+C打开终端

Ctrl+Shift+`创建新终端

outline: none;不生效

input {
    
        outline: none;
     
    }

 解决方法

  input {
      float: none;
      &:focus{
        border-color: #dcdfe6;
        outline: none;
        box-shadow:none;
      }
    }

猜你喜欢

转载自blog.csdn.net/aZHANGJIANZHENa/article/details/130510770
今日推荐