Skip to content

Instantly share code, notes, and snippets.

@jnsprnw
Created April 5, 2018 09:10
Show Gist options
  • Save jnsprnw/766038efd9b5ae4232ea80082ef9f119 to your computer and use it in GitHub Desktop.
Save jnsprnw/766038efd9b5ae4232ea80082ef9f119 to your computer and use it in GitHub Desktop.
<template>
  <div ref="result">
    {{ result }}
  </div>
</template>

<script>

export default {
  props: ['foo'],
  data: function () {
    return {
      factor: 2
    }
  },
  computed: {
    result: function () {
      return calculateValue()
    }
  },
  methods: {
    calculateValue () {
      const { foo, factor } = this
      return foo * factor
    }
  },
  mounted () {
    this.$refs.result.style.color = 'blue'
  }
}
</script>

<style lang="scss" scoped>
  
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment