未验证 提交 bdd6b995 编写于 作者: 听风 提交者: GitHub

Update image.vue

修复上传图片组件bug
上级 11514131
......@@ -13,6 +13,7 @@
<el-upload
class="image-uploader"
:action="`${path}/fileUploadAndDownload/upload`"
:headers="{ 'x-token': token }"
:show-file-list="false"
:on-success="handleImageSuccess"
:before-upload="beforeImageUpload"
......@@ -25,6 +26,7 @@
</template>
<script>
const path = process.env.VUE_APP_BASE_API;
import { mapGetters } from "vuex";
import ImageCompress from "@/utils/image.js";
export default {
name: "upload-image",
......@@ -51,6 +53,9 @@ export default {
path: path,
};
},
computed: {
...mapGetters("user", ["userInfo", "token"]),
},
methods: {
beforeImageUpload(file) {
let isRightSize = file.size / 1024 < this.fileSize;
......@@ -65,7 +70,7 @@ export default {
// this.imageUrl = URL.createObjectURL(file.raw);
const { data } = res;
if (data.file) {
this.$emit("change", data.file.url);
this.$emit("change", this.path + data.file.url);
}
},
},
......@@ -97,4 +102,4 @@ export default {
height: 178px;
display: block;
}
</style>
\ No newline at end of file
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册