基础逻辑链 JS基础(js逻辑或)
1.GET方法 : 发送一个请求获取服务器上的某一处资源 复制代码
2.post方法 向url指定的资源提交数据或附加新的数据
3.安装axios
npm install axios 复制代码
//链表 var reverseList = function (head) { let prev = null; let curr = head; while (curr) { const next = curr.next; curr.next = prev; prev = curr; curr = next; } return prev }; 复制代码
上传图片
<el-upload name="headfile" class="avatar-uploader" action="http://vueshop.glbuys.com/api/user/myinfo/formdatahead?token=1ec949a15fb709370f" :show-file-list="false" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload" > <img v-if="imageUrl" :src="imageUrl" class="avatar" /> <i v-else class="el-icon-plus avatar-uploader-icon"></i> 添加图片 </el-upload> //事件 handleAvatarSuccess(res, file) { this.imageUrl = URL.createObjectURL(file.raw); if (file.response.data.msbox) { this.$emit( "ImgUrl", "http://vueshop.glbuys.com/userfiles/head/" + file.response.data.msbox ); } }, beforeAvatarUpload(file) { const isJPG = file.type === "image/jpeg"; const isLt2M = file.size / 1024 / 1024 < 2; if (!isJPG) { this.$message.error("上传头像图片只能是 JPG 格式!"); } if (!isLt2M) { this.$message.error("上传头像图片大小不能超过 2MB!"); } return isJPG && isLt2M; },
作者:ぃ上上签
链接:https://juejin.cn/post/7033647583142625287