[Vuejs]-Use Vue on top of an existing static website to add filtering functionality

0👍

You can totally bind Vue to a basic HTML template, it’s even the default example on the official doc: https://v2.vuejs.org/v2/guide/index.html#Declarative-Rendering

<div id="app">
  [...content when JS is disabled]
  {{ message }}
</div>
var app = new Vue({
  el: '#app',
  data: {
    message: 'Hello Vue!'
  }
})

Then, you can either create the whole thing in Vue (will not be available wo/ JS tho) or get the various values with a $refs and you should be done to make any kind of logic then !

You could maybe even pass the variable directly into the scope, since it will be defined in the upper scope. Never tried myself tho.

Leave a comment