vue 与 json-server 查询 (四)

接上几篇文章

https://blog.csdn.net/qq_39109182/article/details/85160889

 https://blog.csdn.net/qq_39109182/article/details/85160481

https://blog.csdn.net/qq_39109182/article/details/85161466

这里是通过id 点击查询

//查询数据
sou() {
    let self = this;
    let valTxt = self.numId
    if (self.numId == '') { //如果搜索条件为空 显示全部
        self.test();
    } else {
        this.$axios.get('api/imgListData/' + valTxt).then((res) = > {    
            console.log(res, '查询成功')
            self.ulList = [res.data];
        }, function (err) {    
            console.log(err, '查询失败') 
        })
    }
 
},

猜你喜欢

转载自blog.csdn.net/qq_39109182/article/details/85161575