如何将 'svg' 格式的图标添加到 Bootstrap 的 SweetAlert?

How to add icone in 'svg' format to SweetAlert for Bootstrap?

我尝试在警报 'swal' 中将 image.svg 图标添加到 imageUrl。它与文件 'index.js' 位于同一文件夹中。未添加图标

代码在这里:https://stackblitz.com/edit/react-y5v8tc?file=index.js

import React, { Component } from 'react';
import { render } from 'react-dom';
import Hello from './Hello';
import './style.css';
import swal from 'sweetalert';

class App extends Component {
  constructor() {
    super();
    this.state = {
      name: 'React'
    };
  }

  show = () => {
    console.log('show')
  }

  componentDidMount() {
     swal({
      title: 'dddddd', 
      text: 'dddddddd',
      icon: "info",
      buttons: true,
      showCancelButton: false,
      imageUrl: './image.svg',
      buttons: {
        confirm : {text: 'button'}
      },
      confirmButtonClass: "btn-info",
      closeOnConfirm: false
    })
    .then((isConfirm) => {
      if (isConfirm) {
        this.show();
      }
    });
  }



  render() {
    return (
      <div>
        <Hello name={this.state.name} />
        <p>
          Start editing to see some magic happen :)
        </p>
      </div>
    );
  }
}

render(<App />, document.getElementById('root'));

先尝试加载图标:

import Icon from './image.svg';

并在稍后重新使用它,从 sweet alert 中删除图标:

componentDidMount() {
...
icon: {Icon},
....
}

Link附上。