发表于: 2020-09-04 20:39:39
0 2145
今天完成的事情:
完成了新增数据,删除数据,学习了axios.delete用法
methods: {
submitUpload() {
this.$refs.upload.submit();
},
handleRemove(file, fileList) {
console.log(file, fileList);
},
handlePreview(file) {
console.log(file);
},
handSuccess(res) {
//图片上传服务器返回值
console.log(res.data.url);
this.img = res.data.url;
},
online() {
//保存上线
var price = {
title: this.title,
type: this.type,
status: 2,
img: this.img,
content: this.editorContent,
url: this.url,
};
axios.post("api/a/u/article", qs.stringify(price)).then((res) => {
console.log(res.data);
if (res.data.code == 0) {
this.$router.push({ path: "/article" });
this.$notify({
title: "上线成功",
type: "success",
position: "bottom-right",
});
} else {
this.$notify.error({
title: "请输入完整信息",
position: "bottom-right",
});
}
});
out(item) {
//删除列表数据
this.$confirm(
"删除后该Articler图将直接下架并在本地删除,你确定要执行删除操作吗?",
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
)
.then(() => {
var itemid = item.id;
axios.delete(`api/a/u/article/` + itemid).then((res) => {
console.log(res);
});
//重新渲染数据
this.search();
this.$message({
type: "success",
message: "删除成功!",
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
});
},
遇到的问题:
没有问题
明天计划的事情:
继续完成任务
评论