 
                                    
                                    - 
                                              علی راستینارشدadmin@test.com
- پروفایل
- صندوق ورودی
- قفل صفحه
- خروج
- اجزاء
- اعلان ها
ساده
نمونه کد
<!-- basic -->
<button type="button" class="btn btn-primary" @click="showMessage('Hello, world! This is a toast message.')">Open Toast</button>
<!-- script -->
<script>
    showMessage = (msg = 'متن اعلان تستی.', position = 'bottom-start', showCloseButton = true, closeButtonHtml = '', duration = 3000) => {
        const toast = window.Swal.mixin({
            toast: true,
            position: position || 'bottom-start',
            showConfirmButton: false,
            timer: duration,
            showCloseButton: showCloseButton,
        });
        toast.fire({
            title: msg,
        });
    };
</script> 
                                    
                                محل قرار گیری
نمونه کدمحل قرارگیری بالا
محل قرارگیری پایین
<!-- top left -->
<button type="button" class="btn btn-success" @click="showMessage('متن اعلان تستی.',$store.app.rtlClass === 'rtl' ? 'top-end' : 'top-start')">Top Left</button>
<!-- top center -->
<button type="button" class="btn btn-secondary" @click="showMessage('متن اعلان تستی','top')">Top Center</button>
<!-- top right -->
<button type="button" class="btn btn-info" @click="showMessage('متن اعلان تستی.', $store.app.rtlClass === 'rtl' ? 'top-start' : 'top-end')">Top Right</button>
<!-- bottom left -->
<button type="button" class="btn btn-dark" @click="showMessage('متن اعلان تستی.',$store.app.rtlClass === 'rtl' ? 'bottom-end' : 'bottom-start')">Bottom Left</button>
<!-- bottom center -->
<button type="button" class="btn btn-primary" @click="showMessage('متن اعلان تستی.','bottom')">Bottom Center</button>
<!-- bottom right -->
<button type="button" class="btn btn-secondary" @click="showMessage('متن اعلان تستی.',$store.app.rtlClass === 'rtl' ? 'bottom-start' : 'bottom-end')">Bottom Right</button>
<!-- script -->
<script>
    showMessage = (msg = 'متن اعلان تستی.', position = 'bottom-start', showCloseButton = true, closeButtonHtml = '', duration = 3000) => {
        const toast = window.Swal.mixin({
            toast: true,
            position: position || 'bottom-start',
            showConfirmButton: false,
            timer: duration,
            showCloseButton: showCloseButton,
        });
        toast.fire({
            title: msg,
        });
    };
</script>
                                    
                                بدون دکمه عملیات
نمونه کد
<!-- no action -->
<button type="button" class="btn btn-success" @click="showMessage('متن اعلان تستی.', 'bottom-start',false)">No Action</button>
<!-- script -->
<script>
    showMessage = (msg = 'متن اعلان تستی.', position = 'bottom-start', showCloseButton = true, closeButtonHtml = '', duration = 3000) => {
        const toast = window.Swal.mixin({
            toast: true,
            position: position || 'bottom-start',
            showConfirmButton: false,
            timer: duration,
            showCloseButton: showCloseButton,
        });
        toast.fire({
            title: msg,
        });
    };
</script> 
                                    
                                کلیک برنامه ریزی شده
نمونه کد
<!-- click callback -->
<button type="button" class="btn btn-info" @click="clickCallable()">Click Callback</button>
<!-- script -->
<script>
    clickCallable = () => {
        new window.Swal({
            toast: true,
            position: 'bottom-start',
            text: "Custom callback when action button is clicked.",
            showCloseButton: true,
            showConfirmButton: false,
            // confirmButtonText: 'Delete',
        }).then((result) => {
            new window.Swal({
                toast: true,
                position: 'bottom-start',
                text: 'Thanks for clicking the Dismiss button!',
                showCloseButton: true,
                showConfirmButton: false,
            });
        });
    };
</script>
                                    
                                پیام زماندار
نمونه کد
<!-- click callback -->
<button type="button" class="btn btn-dark" @click="showMessage(msg='متن اعلان تستی.', position= 'bottom-start', duration=5000)">Duration</button>
<!-- script -->
<script>
    showMessage = (msg = 'متن اعلان تستی.', position = 'bottom-start', showCloseButton = true, closeButtonHtml = '', duration = 3000) => {
        const toast = window.Swal.mixin({
            toast: true,
            position: position || 'bottom-start',
            showConfirmButton: false,
            timer: duration,
            showCloseButton: showCloseButton,
        });
        toast.fire({
            title: msg,
        });
    };
</script>
                                    
                                رنگ پس زمینه
نمونه کد
<!-- primary -->
<div>
    <button type="button" class="btn btn-primary" @click="coloredToast('primary')">Primary</button>
    <div id="primary-toast"></div>
</div>
<!-- secondary -->
<div>
    <button type=" button" class="btn btn-secondary" @click="coloredToast('secondary')">Secondary</button>
    <div id="secondary-toast"></div>
</div>
<!-- success -->
<div>
    <button type="button" class="btn btn-success" @click="coloredToast('success')">Success</button>
    <div id="success-toast"></div>
</div>
<!-- danger -->
<div>
    <button type="button" class="btn btn-danger" @click="coloredToast('danger')">Danger</button>
    <div id="danger-toast"></div>
</div>
<!-- warning -->
<div>
    <button type="button" class="btn btn-warning" @click="coloredToast('warning')">Warning</button>
    <div id="warning-toast"></div>
</div>
<!-- info -->
<div>
    <button type="button" class="btn btn-info" @click="coloredToast('info')">Info</button>
    <div id="info-toast"></div>
</div>
<!-- script -->
<script>
    coloredToast = (color) => {
        const toast = window.Swal.mixin({
            toast: true,
            position: 'bottom-start',
            showConfirmButton: false,
            timer: 3000,
            showCloseButton: true,
            animation: false,
            customClass: {
                popup: `color-${color}`
            },
            target: document.getElementById(color + '-toast')
        });
        toast.fire({
            title: 'متن اعلان تستی.',
        });
    };
</script>
                                    
                                
                    ©  روشاک