vue 点击图标切换图标_Vue的动画SweetAlert图标

这篇博客介绍了如何在Vue中使用一个简洁的包装器来实现SweetAlert的动画图标。主要内容包括安装、导入、使用方法,特别是对于Nuxt用户的特殊使用注意事项。文章提供了不全局使用包时的替代用法,并解决了在Nuxt中样式注入的问题。
摘要由CSDN通过智能技术生成

vue 点击图标切换图标

Vue的动画SweetAlert图标 (Animated SweetAlert Icons for Vue)

A clean and simple Vue wrapper for SweetAlert's fantastic status icons. This wrapper is intended for users who are interested in just the icons. For the standard SweetAlert modal with all of its bells and whistles, you should probably use Vue-SweetAlert 2

一个干净简单的Vue包装器,用于SweetAlert的出色状态图标。 该包装器仅适用于仅对图标感兴趣的用户。 对于带有所有铃声的标准SweetAlert模态,您可能应该使用Vue-SweetAlert 2

Animated-SweetAlert-Icons-for-Vue

安装 (Install)

npm install --save vue-sweetalert-icons

进口 (Import)

import SweetAlertIcons from 'vue-sweetalert-icons';

Vue.use(SweetAlertIcons);

If you're using Nuxt, you might need additional steps (read more)

如果您使用的是Nuxt,则可能需要其他步骤(了解更多信息)

(Use)

<template>
    <!-- Icon can be one of: "success", "warning", "info", "error" and "loading" -->
    <sweetalert-icon icon="success" />
</template>

替代用法 (Alternative Usage)

If you'd rather not use the package globally, you can import SweetalertIcon for use with a single vue component/instance instead:

如果您不想在全球范围内使用该软件包,则可以导入SweetalertIcon以便与单个vue组件/实例一起使用:

<template>
    <sweetalert-icon icon="success"></sweetalert-icon>
</template>

<script>
    import SweetalertIcon from 'vue-sweetalert-icons';

    export default {
        components: { SweetalertIcon },
    }
</script>

Nuxt的用法 (Usage with Nuxt)

Due to an issue with the way styles are injected into Nuxt, please wrap <sweetalert-icon /> around <no-ssr> tags.

由于样式注入Nuxt的方式存在问题,请在<no-ssr>标记周围包裹<sweetalert-icon />

<no-ssr>
    <sweetalert-icon icon="info" />
</no-ssr>

翻译自: https://vuejsexamples.com/animated-sweetalert-icons-for-vue/

vue 点击图标切换图标

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值