VueJS Getting Started

Let's get started with VueJS!

by wostex

HTML

<script src="https://unpkg.com/vue/dist/vue.js"></script>

<div id="app">
  <p>{{ helloText }}</p>
</div>

JavaScript

const mylib = {
    hello : (text1, text2) => { 
    	return `Hello! ${text1} ${text2}`
    },
    install: function(Vue){
      Object.defineProperty(Vue.prototype, 'mylib', {
        get () { return mylib }
      })
    }
};

Vue.use(mylib);

new Vue({
    el: '#app',
    data: {
    	helloText: mylib.hello('one', 'two')
    }
});