Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including vue-static-data with all npm packages installed. Try it out:

var vueStaticData = require("vue-static-data")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

vue-static-data v0.4.0

Add static data to Vue instances.

Vue Static Data

Add staticData to Vue instances and watch in awe as it does nothing.

yarn add vue-static-data

Setup

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>

Author

Matthew Wagerfield

License

MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free