vue.js确认对话框_vue.js精美的未保存的更改对话框

这个博客介绍了如何使用Vue.js创建一个美观的未保存更改对话框,该对话框受到Squarespace管理员组件的启发。内容包括对话框的特点,如平滑动画、响应式设计、键盘导航和背景变暗功能,以及安装、使用和构建过程。
摘要由CSDN通过智能技术生成

vue.js确认对话框

Vue未保存的更改对话框 (Vue Unsaved Changes Dialog)

A beautiful unsaved changes dialog, inspired by a component from the Squarespace admin.

一个美丽的未保存的更改对话框,灵感来自Squarespace管理员的组件。

  • Save, Discard, and Cancel buttons

    保存,放弃和取消按钮

  • On desktop, popup appears precisely underneath the mouse cursor

    在桌面上,弹出窗口恰好出现在鼠标光标下方

  • Smoothly animates in and out

    平滑地动画出入

  • Popup intelligently avoids the window edges and responds to window resizing

    弹出窗口可智能地避免窗口边缘并响应窗口大小调整

  • Full responsive: renders as in full-screen on mobile

    全响应:在移动设备上以全屏方式呈现

  • Keyboard navigable/accessible

    键盘可导航/可访问

demo

更多东西 (More goodies)

  • Includes buttery animations for both desktop and mobile

    包括桌面和移动设备的黄油动画

  • Mouse listener is throttled to avoid performance issues (bundles lodash.throttle, an extra 2KB)

    限制鼠标侦听器以避免性能问题(将lodash.throttle捆绑lodash.throttle ,额外增加2KB)

  • All listeners are deactivated when component is torn down

    组件拆除时,所有监听器均被停用

  • Darkens background

    使背景变暗

  • Clicking the background dismisses the dialog (same as cancel button)

    单击背景可关闭对话框(与“取消”按钮相同)

  • Bundles desktop, mobile, popup positioning logic, and all styles and animations in 14KB

    将桌面,移动设备,弹出式定位逻辑以及所有样式和动画捆绑在一起,格式为14KB

安装 (Install)

npm i vue-unsaved-changes-dialog

用法 (Usage)

<VueUnsavedChangesDialog
  :title="Unsaved Changes"
  :subtitle="['You have unsaved changes', 'Would you like to save or discard them?']"
  :show="shouldShowDialog"
  @cancel="cancelFn"
  @discard="discardFn"
  @save="saveFn"/>

仍然 (Still)

desktop

mobile

React灵敏 (Responsive)

responsive

现场开发 (Live Development)

You'll need NPM and the Vue CLI.

您将需要NPMVue CLI

npm install 
npm run serve

建造 (Building)

You'll need to install Rollup.js to run the build script. Install it with npm install --g rollup

您需要安装Rollup.js才能运行构建脚本。 用npm install --g rollup

npm run build

Running the build script generate main (.ssr.js), module (.esm.js), and unpkg (.min.js) versions in the dist directory.

运行构建脚本会在dist目录中生成main ( .ssr.js ), module ( .esm.js )和unpkg ( .min.js )版本。

翻译自: https://vuejsexamples.com/a-beautiful-unsaved-changes-dialog-with-vue-js/

vue.js确认对话框

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值