Warning: session_start(): open(/var/lib/php/fpm/session/sess_lvu5oje21nocs6scktrealgpns, O_RDWR) failed: No such file or directory (2) in /var/www/tst02/wp-content/plugins/wordpress-social-login/wp-social-login.php on line 64

Warning: session_start(): Failed to read session data: files (path: /var/lib/php/fpm/session) in /var/www/tst02/wp-content/plugins/wordpress-social-login/wp-social-login.php on line 64
Vue Resize Directive - Bootstrap 4 & Material Design - Material Design for Bootstrap

Resize MDB Pro component

Vue Bootstrap Resize - Bootstrap 4 & Material Design

The mdb-resize directive calls the given mthod every time user resizes the window

Live Preview

Basic usage

Step 1: Import the directive from 'mdbvue'


        <script>
          import { mdbResize } from "mdbvue";
        </script>
      

Step 2: Add mdbResize to the directives object


        <script>
          import { mdbResize } from "mdbvue";
          export default {
            directives: {
              mdbResize
            }
          };
        </script>
      

Step 3: Attach the directive to an element and pass a callback


        <template>
          <div v-mdb-resize="handleResize" />
        </template>
      

        <script>
          import { mdbResize } from "mdbvue";
          export default {
            directives: {
              mdbResize
            },
            methods: {
              handleResize() {
                console.log('window resized!')
              }
            }
          };
        </script>
      

Step 4: If you need to call the given function not only on resize event, but also immediately after the directive has been inserted, use :start modifier


          <template>
            <div v-mdb-resize:start="handleResize" />
          </template>
        

          <script>
            import { mdbResize } from "mdbvue";
            export default {
              directives: {
                mdbResize
              },
              methods: {
                handleResize() {
                  console.log('This message will be displayed once the directive has been inserted and every time user resizes the window')
                }
              }
            };
          </script>