<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>自定义指令</h1>
<div id="app">
    <button v-if="msg<=5" v-btn="msg" @click="abtn">{{msg}}</button>
</div>
<script src="js/vue.js"></script>
<script>
  new Vue({
      el:"#app",
      data:{
            msg:0
      },
      methods:{
            abtn:function () {
                this.msg++;
            }
      },
      directives:{
          btn:{//自定义函数
              bind:function () {//钩子函数
                  console.log('bind')
              },
              update:function (e,o) {//钩子函数
                  e.innerHTML=o.value;
                  console.log('update')
              },
              unbind:function () {//钩子函数
                  console.log('unbind')
              }
          }
      }
  })
</script>
</body>
</html>