0

我正在关注 php laravel 的 youtube 中的教程。我很难显示,sweetalert2但我按照视频中的所有说明进行操作。

app.js 中的代码作为 global 的 globalJS

import swal from 'sweetalert2';
window.swal = swal;

const toast = swal.mixin({
     toast: true,
     position: 'top-end',
    showConfirmButton: false,
    timer: 3000
});  

window.toast = toast;

我的 User.vue 中的代码

  SaveUser() {
  this.$Progress.start();
  this.form.post("api/user");
  this.loadUsers();
  Toast.fire({
    type: "success",
    title: "Signed in successfully"
  });
  this.$Progress.finish();
}

在文档Here中,代码是Toast.fire,但在我关注的视频中是toast({})。我尝试了两个代码,但它不工作。我的代码有问题吗?

编辑

我使用 Google Chrome 在不同的计算机上运行此代码,Version 0.69.135 Chromium: 77.0.3865.120 (Official Build) (64-bit) 并且Brave Version 77.0.3865.120 (Official Build) (64-bit)运行良好。

但在我的 PC Brave 版本 0.68.142 Chromium: 77.0.3865.90 (Official Build) (64-bit) 中,Google Chrome Version 77.0.3865.120 (Official Build) (64-bit)它不起作用。

4

0 回答 0