0.4.0 • Published 7 years ago
vue-static-data v0.4.0
Vue Static Data
Add staticData to Vue instances and watch in awe as it does nothing.
yarn add vue-static-dataSetup
import Vue from "vue"
import VueStaticData from "vue-static-data"
Vue.use(VueStaticData)Usage
<template>
  <div>
    <button @click="updateStatic" v-text="staticProp" />
    <button @click="updateReactive" v-text="reactiveProp" />
  </div>
</template>
<script>
export default {
  // Object | Function
  staticData: () => ({
    staticProp: "static"
  }),
  data: () => ({
    reactiveProp: "reactive"
  }),
  methods: {
    updateStatic() {
      this.staticProp = "static clicked"
    },
    updateReactive() {
      this.reactiveProp = "reactive clicked"
    }
  }
}
</script>