Tip.js 轻量级交互组件库

项目地址:https://github.com/getwebtools/tip

🚀 特性介绍

📦 安装使用

<script src="tip.js"></script> <script> // 直接使用,无需任何HTML设置 tip.success('操作成功!'); tip.error('出现错误!'); tip.info('这是一条信息'); tip.warning('请注意!'); </script>

🍞 Toast 提示

显示不同类型的提示消息,支持自定义显示时间

Toast 提示代码

❓ 确认对话框

显示确认对话框,支持自定义标题和按钮文字

确认对话框代码

📝 输入对话框

显示输入对话框,支持默认值和占位符

输入对话框代码

⏳ 加载遮罩

显示加载状态,支持自定义提示文字

加载遮罩代码

🔄 复杂流程演示

演示多个组件组合使用的复杂交互流程

复杂流程代码

🧹 清理功能

清理所有组件状态

清理功能代码

📚 API 文档

// Toast 提示 tip.toast(message, type, options) tip.success(message, options) tip.error(message, options) tip.info(message, options) tip.warning(message, options) // 确认对话框 tip.confirm(message, callback, options) // 输入对话框 tip.prompt(message, callback, options) // 加载遮罩 tip.loading.show(message) tip.loading.hide() tip.showLoading(message) tip.closeLoading() // 清理方法 tip.clearToasts() tip.closeAllModals() tip.closeAllLoading() tip.clearAll()