VueJs + Element UI : How to custom el-dialog title?

dede.brahma picture dede.brahma · Jun 27, 2018 · Viewed 9.7k times · Source

I created a dialog with a custom el-dialog title using the el-icon, but the el-icon does not appear. how to make the icon appear ?

here my code

<el-dialog :title="titleData" :visible.sync="dialogVisible" width="30%">
  <span>This is a message</span>
  <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">Cancel</el-button>
    <el-button type="primary" @click="dialogVisible = false">Confirm</el-button>
  </span>
</el-dialog>

methods: {
  setTitle() {
  this.titleData = '<el-icon-info></el-icon-info>' + 'Info'
}

here my fiddle: https://jsfiddle.net/dede402/y93kvew5/6/

Answer

budgw picture budgw · Jun 27, 2018

just use the slot title available on the el-dialog component. Here is your fiddle updated with a working solution : https://jsfiddle.net/budgw/y93kvew5/10/