Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Commit

Permalink
fix(*): 修复 file 接口下图片宽高大于 4096 会报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
mutoe committed Oct 19, 2018
1 parent 3550b6d commit 0684f8d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/FeedCard/v-async-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default Vue => {
};

const isCanShow = item => {
const { el, file, q = 40 } = item;
const { el, file, q = 40, w, h } = item;
const isIMG = el.nodeName === "IMG";
if (checkInView(el)) {
let image = new Image();
Expand All @@ -58,9 +58,10 @@ export default Vue => {
* 获取图片真实链接
*/
api
.get(`/files/${file}?q=${q}&json=1`, {
.get(`/files/${file}`, {
// 验证 status ; 屏蔽 404 抛错
vaildateStatus: s => s === 200 || s === 201 || s === 204 || s === 400
vaildateStatus: s => s === 200 || s === 201 || s === 204 || s === 400,
params: { json: 1, q: w > 4096 || h > 4096 ? undefined : q }
})
.then(({ data: { url } }) => {
if (url) {
Expand Down

0 comments on commit 0684f8d

Please sign in to comment.