若依框架常见问题

1.展开某一导航栏时所有导航栏会全部展开

        将SidebarItem.vue中的:index=“resolvePath(item.path)” 改为 :index=“resolvePath(onlyOneChild.path)”

2.使用axios发送请求

       
del(){
         const formData = new FormData();
         formData.append(key,value); 
           //无上述两行代码数据不以请求表单的方式发送

         try {
              axios.post('http://***********', formData,{
                headers: {
                  'token': token
                }
              }).then(response => {
                if(response.data.code === '0' && response.data.msg === ""){
                  this.$modal.msgSuccess(delWords[i]+"删除成功");
                  this.getList();
                }else{
                  this.$modal.msgSuccess( response.data.msg);
                }
              });
            } catch (error) {
              console.error('发送数据时出错:', error);
            }
}

3.使用this.$modal.confirm弹窗之后this会失效,无法获取this.****

      在使用this.$modal.confirm弹窗前先定义变量并将数据赋值给该变量

      /** 删除按钮操作 */
      handleDelete(row) {
        const delWords=this.words;
        const token=this.jqtoken;
        this.$modal.confirm('是否确认删除单词"' + delWords + '"的数据项?').then(function() {
          for(var i=0;i<delWords.length;i++){
            const formData = new FormData();
            formData.append('word', delWords[i]); // 假设你要发送的字段名为 'word'
            try {
              axios.post('http://********************', formData,{
                headers: {
                  'token': token
                }
              }).then(response => {
                if(response.data.code === '0' && response.data.msg === ""){
                  this.$modal.msgSuccess(delWords[i]+"删除成功");
                  this.getList();
                }else{
                  this.$modal.msgSuccess( response.data.msg);
                }
              });
            } catch (error) {
              console.error('发送数据时出错:', error);
            }
          }

        }).then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        }).catch((error) => {
          this.$modal.msgWarning("删除失败:"+error);
        });
      },

4.若依在使用某些未设置权限的按钮或者调用某些其它系统的接口时提示当前操作没有权限

        (1)取消按钮的权限设置,删掉代码v-hasPermi="['system:information:edit']"

        (2)取消获取角色的代码

        this.postOptions = response.posts;
        this.roleOptions = response.roles;

        将

        getUser().then(response => {
          this.postOptions = response.posts;
          this.roleOptions = response.roles;
          this.open = true;
          this.title = "添加单词";
        });

变化为

          this.open = true;
          this.title = "添加单词";

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值