使用created钩子

import AppLayout from '@/components/app-layout'
import axios from 'axios'

export default {
  name: 'home',
  data () {
    return {
      msg: 'Welcome to Your Vue.js home',
      name:'test',  
      IssueDesc: '',
      IssueList: [{IssueDesc:"test issue",comments:['123','123345','22222']}],
    }
  },
  components: {AppLayout},
  methods: {
    changeName: function() {
        this.$data.name+='...';
        axios.get('static/data/data.json').then(function  (resp) {
          console.log('XXXX: ',resp)
        }).catch(function  (err) {
          console.log('XXXX: ',err)
        })
      },
    addIssue: function  () {
      console.log('XXXX: ',this.IssueDesc)
      this.IssueList.push({
        IssueDesc:this.IssueDesc,
        comments:[]
      });
    }
  },
  created: function  () {
    //get init data
    console.log('XXXX: ','created')
  }
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-27
  • 2022-12-23
  • 2021-07-01
  • 2021-04-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-05
  • 2022-12-23
  • 2022-12-23
  • 2022-01-06
  • 2021-08-22
  • 2021-10-15
  • 2021-08-27
相关资源
相似解决方案