SweetAlert Basic 安装不起作用

问题描述

我在 angular 中创建了一个新项目并安装了 SweetAlert 在构建项目时,我收到以下错误

enter image description here

我按照这里的步骤操作: https://sweetalert.js.org/guides/#installation

import { Component,OnInit } from "@angular/core";
import swal  from  'sweetalert'


@Component({
    templateUrl:'./inactive.component.html'
})
export class InactiveComponent implements OnInit{

    constructor(){

    }

    clickme(){
        swal("HelloWorld");
    }

    ngOnInit(){
        
    }
}

我已经尝试了互联网上的解决方案。没有什么对我有用。我无法在 node_modules 中进行更改。有没有其他解决方法

编辑: 我试过这个,但同样的错误

import { Component,OnInit } from "@angular/core";
import * as _swal  from  'sweetalert';
import {SweetAlert} from'sweetalert/typings/core'


@Component({
    templateUrl:'./inactive.component.html'
})
export class InactiveComponent implements OnInit{

    isLoading:boolean = true;
    constructor(){

    }

    clickme(){
        const swal:SweetAlert = _swal as any;
        swal("T popup")
    }

    ngOnInit(){
        
    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)