DEV Community

jhomegroup
jhomegroup

Posted on • Edited on

1

Sweer Alert [TH] With Vuejs

npm i vue-sweetalert2
Enter fullscreen mode Exit fullscreen mode

main.js

import VueSweetalert2 from 'vue-sweetalert2';
import 'sweetalert2/dist/sweetalert2.min.css';

Vue.use(VueSweetalert2);
Enter fullscreen mode Exit fullscreen mode

Success

    this.$swal({
      position: "top",
      icon: "success",
      title: "บันทึกข้อมูลสำเร็จ!",
      showConfirmButton: false,
      timer: 1600,
    });
Enter fullscreen mode Exit fullscreen mode

AlertEditSuccess

    this.$swal({
      position: "top",
      icon: "success",
      title: "แก้ไขข้อมูลสำเร็จ!",
      showConfirmButton: false,
      timer: 1600,
    });
Enter fullscreen mode Exit fullscreen mode

AlertDeleteConfirm

    this.$swal({
      title: "คุณแน่ใจไหม?",
      text: "คุณจะลบรายการข้อมูลนี้ และไม่สามารถกู้คืนกลับได้!",
      icon: "warning",
      showCancelButton: true,
      confirmButtonColor: "#3085d6",
      cancelButtonColor: "#d33",
      confirmButtonText: "ใช่ลบ!",
      cancelButtonText: "ปิด",
    }).then((result) => {
      if (result.isConfirmed) {
        this.$swal("ลบแล้ว!", "รายการข้อมูลนี้ถูกลบแล้ว.", "success");
      }
    });
Enter fullscreen mode Exit fullscreen mode

AlertError

    this.$swal({
      position: "top",
      icon: "error",
      title: "เกิดข้อผิดพลาด! ไม่สามารถทำรายการได้",
      showConfirmButton: false,
      timer: 1600,
    });
Enter fullscreen mode Exit fullscreen mode

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay