1 new Vue({ 2 el: '#main', 3 data: { 4 selectRepositoryOfTopInputParam: []//初始化页面,展示前10条内容 5 }, 6 7 beforeCreate: function () { 8 //页面初始化 9 this.$nextTick(() => { 10 this.InitData(); 11 }); 12 }, 13 14 methods: { 15 //页面初始化 16 InitData() { 17 const _this = this; 18 _this.selectRepositoryOfTopInputParam = true;//页面初始化显示前10条 19 axios.get('http://localhost:8080/selectRepositoryOfTopInputParam', {params: {displayItems: 10}}).then(function (response) { 20 console.log(response); 21 if (response.status === 200) { 22 _this.selectRepositoryOfTopInputParam = response.data; 23 } 24 }).catch(function (err) { 25 console.log(err); 26 _this.$message.error(err.toString()); 27 }); 28 } 29 }, 30 beforeDestroy() { 31 32 } 33 })