1.1.1 • Published 5 years ago

vue2-deepob v1.1.1

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

vue2-deepob

Deep observable for Vue 2.x , advance experience Vue3 Observeable .

Note

not support IE11

example

https://github.com/leozale/vue2-deepob/tree/master/example

Install

import Vue from "vue";
import DeepOB from "vue2-deepob";
Vue.use(DeepOB);

Demo

<template>
  <div>{{ user.name }}</div>
  <button @click="user.changeName()"></button>
  <button @click="user.addOtherName()"></button>
   <div>  {{user.otherName}}  <button @click="user.deleteOtherName()"> delete </button> </div>
</template>

<script>

  class User{

      constructor(){
          this.name = "default name";
          // no otherName property!!!
      }

      changeName(){
          this.name = 'testname-'+Date.now();
      }

      addOtherName(){
          this.otherName = "otherName!!!";
      }

      deleteOtherName(){
          delete this.otherName; //  no need Vue.delete !
      }
  }


  new Vue({
      data(){
          return {
              user:this.$deepob(new User())
          }
      }
  })
</script>

License

MIT

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago