[Vuejs]-Getuikit 3 sortable element on moved not triggered

0👍

I managed to resolve the problem, so if anyone has the same issue:

Once I moved the code into the mounted() method of the vue.js it all works fine.

mounted() {
    //UIKit ordering action - THIS DOES NOT
    UIkit.util.on('#sortable', 'moved', function (item) {
      console.log('moved triggered');
    });

    let stateCheck = setInterval(() => {
      if (document.readyState === 'complete') {
        clearInterval(stateCheck);
        this.getProductsConfig();
      }
    }, 100);
  },

the UIkit.notification works fine, but I guess since the util is attached to event it has to be made available to vue on startup.

0👍

If you added UIkit as <script src="./src/js/uikit.min.js"></script> in your index.html then you can’t use it inside Vue as expected, instead do:

npm i --save uikit

then in your Component

import UIkit from "uikit";

after that you can use everywhere

methods: {
  alertOnClick(msg) {
      UIkit.notification(msg, "danger");
    }
  }
}

Leave a comment