1.0.0 • Published 5 years ago

vue-who-moved-my-cheese v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

vue-who-moved-my-cheese

Can detect computed or watcher is updated by which specific variable

How to use?

import, then watch computed or watcher

<template>
  <div>
    <div>
      <span>Last Name</span>
      <input v-model="lastname" >
    </div>
    <div>
      <span>First Name</span>
      <input v-model="firstname" >
    </div>
    <div> FullName: {{fullname}}</div>
  </div>
</template>

<script>
  import {WhoMovedMyCheese} from 'vue-who-moved-my-cheese';

  export default {
    name: 'UserInfo',
    data() {
      return {
        firstname: 'Ken',
        lastname: 'Gao',
      }
    },
    mounted() {
      WhoMovedMyCheese(this, ['fullname', 'updateComponent']);
    },
    computed: {
      fullname() {
        return this.lastname + ', ' + this.firstname;
      },
    },
  }
</script>

<style scoped>
</style>

if you change firstname or lastname, fullname will updated with it.

and WhoMovedMyCheese will know the effection from which variable exactly.

image

What it did?

just add name on vue Dep. image

1.0.0

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago