Skip to content

Very simple but powerful modal in nuxt framework

Notifications You must be signed in to change notification settings

s3rver/nuxt-modal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Very simple modal for nuxt framework

screen-capture-_1_.mp4
# install module
$ npm i @s3rver/nuxt-modal

Steps of use

1 - Add module to nuxt.config.js

// nuxt.config.js
export default {
    //...
    modules: ['@s3rver/nuxt-modal']
    //...
}

2 - Register modals for layout

<template>
    <div>
        <nuxt />

        <!-- added line -->
        <register-modals />
    </div>
</template>

3 - Making directory modals

In the main root of the project, create a directory called modals and save your modals with the vue extension

options

nuxt.config.js

default options

// nuxt.config.js
export default {
    //...
    modal: {
        pluginName: "modal", // name plugin 
        layout: "default", // layout desktop
        mobileLayout: "defaultMobile", // layout mobile
        mobileSize: 400, // mobile or desktop window size
        responsive: false,
    },

    modules: ['@s3rver/nuxt-modal']
    //...
}

Responsive

Responsive value is disabled by default and you must define separate components for mobile and desktop dimensions

If enabled, you do not need to create two components

image

layout & mobileLayout

The value is equal to the name of the registered component

Making Custom Layout

image

And then open the modal

image