网站首页 > 博客文章 正文
今天给大家分享一款超酷的多功能Vue消息弹出层组件VueSimpleAlert。
vue-simple-alert 基于vue.js+sweetalert2构建的轻量级alert、confirm、prompt提示组件。支持TS调用。
特性
- 提供类似Dom window的方法:alert()、confirm()、prompt()
- 基于vue2+sweetalert2开发
- 通过基于Promise的接口
- 支持TypeScript
安装
$ npm i vue-simple-alert -S
快速使用
// 全局引入组件
import Vue from "vue";
import VueSimpleAlert from "vue-simple-alert";
Vue.use(VueSimpleAlert);
//Vue.use(VueSimpleAlert, { reverseButtons: true });
// 使用组件
this.$alert("Hello Vue Simple Alert.");
this.$confirm("Are you sure?").then(() => {
//do something...
});
this.$prompt("Input your name").then(text => {
// do somthing with text
});
高级用法
可以通过$fire使用sweetalert2的fire方法。
this.$fire({
title: "Title",
text: "text",
type: "success",
timer: 3000
}).then(r => {
console.log(r.value);
});
非常不错的一款开源Vue.js弹框组件,需要的不可错过哈。
# sweetalert2
http://mishengqiang.com/sweetalert2/
# 演示地址
https://sweetalert2.github.io/
# 仓库地址
https://github.com/sweetalert2/sweetalert2
好了,今天就分享到这里。希望以上的分享对大家有所帮助。
猜你喜欢
- 2024-09-26 Vue3全新的前端构建工具vite学习(前端vue项目开发流程及架构)
- 2024-09-26 Vue核心知识:8.5如何在vuex中使用异步修改?推荐行为触发action
- 2024-09-26 Vue.nextTick 的工作机制(vue中nexttick原理)
- 2024-09-26 ES6(四)用Promise封装一下IndexedDB
- 2024-09-26 Vue项目处理错误上报如此简单(vue项目中遇到的问题,你是怎么解决)
- 2024-09-26 Vue开发:通过异步的方式加载vue组件
- 2024-09-26 Vue.js项目模板搭建(vue.js环境搭建)
- 2024-09-26 vue.js深入篇(一、响应式原理)(vue响应式源码解析)
- 2024-09-26 Vue中的nextTick方法是用来做什么的?
- 2024-09-26 Vue - 简单实现一个命令式弹窗组件
你 发表评论:
欢迎- 最近发表
-
- 给3D Slicer添加Python第三方插件库
- Python自动化——pytest常用插件详解
- Pycharm下安装MicroPython Tools插件(ESP32开发板)
- IntelliJ IDEA 2025.1.3 发布(idea 2020)
- IDEA+Continue插件+DeepSeek:开发者效率飙升的「三体组合」!
- Cursor:提升Python开发效率的必备IDE及插件安装指南
- 日本旅行时想借厕所、买香烟怎么办?便利商店里能解决大问题!
- 11天!日本史上最长黄金周来了!旅游万金句总结!
- 北川景子&DAIGO缘定1.11 召开记者会宣布结婚
- PIKO‘PPAP’ 洗脑歌登上美国告示牌
- 标签列表
-
- ifneq (61)
- messagesource (56)
- aspose.pdf破解版 (56)
- promise.race (63)
- 2019cad序列号和密钥激活码 (62)
- window.performance (66)
- qt删除文件夹 (72)
- mysqlcaching_sha2_password (64)
- ubuntu升级gcc (58)
- nacos启动失败 (64)
- ssh-add (70)
- jwt漏洞 (58)
- macos14下载 (58)
- yarnnode (62)
- abstractqueuedsynchronizer (64)
- source~/.bashrc没有那个文件或目录 (65)
- springboot整合activiti工作流 (70)
- jmeter插件下载 (61)
- 抓包分析 (60)
- idea创建mavenweb项目 (65)
- vue回到顶部 (57)
- qcombobox样式表 (68)
- vue数组concat (56)
- tomcatundertow (58)
- pastemac (61)
本文暂时没有评论,来添加一个吧(●'◡'●)