[Vuejs]-VueJS Event Handler for Changing CSS

0👍

Found it! No need for CSS

var vue = new Vue ({

   el: "#body",

   data: {

      background: "--BACKGROUND LINK--",
   
   },

   watch: {
        background: {
            immediate: true,
            handler(new_background, old_background) {
                document.getElementById("body").style.background = "linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url(" + new_background + ") no-repeat center center fixed";
            },
        },
    },

});

Leave a comment