对接接口

This commit is contained in:
2020-05-25 22:03:54 +08:00
parent 64872b2e78
commit dbc607f67d
3 changed files with 140 additions and 35 deletions

View File

@ -9,20 +9,36 @@ const app = new Vue({
]
}
},
created() {
console.log("Vue")
},
methods: {
detail(index){
console.log(this.ruleData[index])
// some jump
},
loadData(){
$.ajax({
url: qlgUrl("app/trade_rule/index"),
method: "GET",
dataType: 'json',
success: function(res){
if(res.status == 1){
this.ruleData = res.data;
localStorage.setItem("LOCAL_RULE", JSON.stringify(res.data));
}else{
mui.alert(res.msg);
}
},
error: function(err){
mui.alert("请求失败");
self.back();
}
});
}
},
mounted() {
// some ajax
this.ruleData = [
{id: 1, name: '这个是个开发中的页面呢', announced_at: "2019-09-09 18:09:01"},
{id: 2, name: '待我来继续开发呢', announced_at: "2019-09-09 19:09:01"},
]
created() {
var localData = localStorage.getItem("LOCAL_RULE");
this.loadData();
if(localData){
this.noteData = JSON.parse(localData);
}
}
})