el-tooltip中slot的使用

先上原代码

<el-tooltip placement="top" content="提示">

      <el-button>Top center</el-button>

    </el-tooltip>

效果:

 使用slot自定义内容,还可以添加事件等

<el-tooltip placement="top">

      <div slot="content">

        <el-button @click="handleClick1">内容一</el-button>

        <el-button @click="handleClick2">内容二</el-button>

        </div>

      <el-button>Top center</el-button>

    </el-tooltip>

效果:

点击事件:

handleClick1(){

      alert('我是内容一的点击事件')

    },

效果: 

猜你喜欢

转载自blog.csdn.net/weixin_42611825/article/details/125364069