VUE失去焦点提交修改值

xxx.vue

<input class="ml6 w85 bdr-6 bd-none text-center" type="text" v-model="month" v-on:blur.lazy="monthCount">

 

<script>
import store from '../../store'
export default {
  data () {
    return {
      month: ''
    }
  },
  created: function () {
    this.getMonthCount()
  },
  methods: {
    monthCount () {
      let url = 'http://192.168.44.44:8083/xxx.json'
      let options = {
        method: 'PUT',
        body: 'value=' + this.month
      }
      options.headers = new Headers()
      options.headers.append('Content-Type', 'application/x-www-form-urlencoded')
      options.headers.append('token', store.state.auth.accessToken)
      fetch(url, options).then(response => response.json()).then(response => console.log(response))
    }
  }
}

</script>

 

posted @ 2017-12-20 06:59  嘆世殘者——華帥  阅读(4134)  评论(0编辑  收藏  举报