vue-element的<el-tooltip>气泡提示失效问题

问题:

页面按钮太多, 弹框很多, 但是有些不必要的, UI也没说有限制,  我想用<el-tooltip>来根据不同状态来用气泡提示 ,

使用时<el-tooltip>经常用来包含<el-button>, 但是遇到<el-button>为禁用disabled=true的时候, 会失效.

解决办法:

使用<span>来让这些<el-button>块成为内联元素( ele的UI弹性布局 ,<el-col :span="24"> 布局很难操作 )

最终结果:

代码:

<el-tooltip content="【查看】请先选中一条数据进行操作!"
                  :disabled="activeList && activeList.length == 1 ? true : false"
                  placement="top">
        <span>
          <el-button :disabled="activeList && activeList.length==1 ? false : true"
                     @click="handleButtonType('see')">查看</el-button>
        </span>

      </el-tooltip>
      <el-tooltip :disabled="activeList && activeList.length==1 && activeList[0].status == 'noaudit' ? true : false"
                  placement="top">
        <div slot="content">【修改】、【删除】、【保存1】按钮<br />仅可对状态为保存1的数据进行操作!</div>
        <span class="mLeft10 mRight10">
          <el-button :disabled="activeList && activeList.length==1 && activeList[0].status == 'noaudit' ? false : true"
                     @click="handleButtonType('edit')">修改</el-button>
          <el-button :disabled="activeList && activeList.length==1 && activeList[0].status == 'noaudit' ? false : true"
                     @click="handleButtonType('del')">删除</el-button>
          <el-button :disabled="activeList && activeList.length==1 && activeList[0].status == 'noaudit' ? false : true"
                     @click="handleButtonType('audit')">嗯嗯嗯</el-button>
        </span>
</el-tooltip>
<el-tooltip content="【保存】仅可对状态为保存2的数据进行操作!"
                  :disabled="activeList && activeList.length==1 && activeList[0].status == 'audit' ? true : false"
                  placement="top">
        <span>
          <el-button type="primary"
                     :disabled="activeList && activeList.length==1 && activeList[0].status == 'audit' ? false : true"
                     @click="handleButtonType('noaudit')">保存2</el-button>
        </span>
</el-tooltip>
原文地址:https://www.cnblogs.com/wangduojing/p/13714221.html