Skip to content

Commit 94f9d62

Browse files
committed
chore: fix remote downloads and cleanup
1 parent 0d27d77 commit 94f9d62

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

src/components/AppButton.vue

+16-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
font !== 'inherit' ? font : color ? 'white' : 'black'
1515
} !important;
1616
`"
17-
class="mt-4 md:mt-0 md:mx-2 px-6"
17+
:class="!noMargin && 'mt-4 md:mt-4 md:mx-2'"
18+
class="px-6"
1819
>
1920
{{ $t(`${text}`) }}
2021
</button>
@@ -59,25 +60,33 @@ export default {
5960
type: String,
6061
default: "inherit",
6162
},
63+
noMargin: {
64+
type: Boolean,
65+
default: false,
66+
},
6267
},
6368
computed: {
69+
isRemoteDownload() {
70+
return this.download && this.localurl;
71+
},
6472
downloadUrl() {
65-
if (this.download && this.localurl) {
73+
if (this.isRemoteDownload) {
6674
return `${this.localurl}${this.download}`;
6775
} else return this.download;
6876
},
6977
hrefUrl() {
70-
if (this.download && this.localurl) {
71-
return `${this.localurl}${this.download}`;
72-
}
7378
if (this.localurl && process.client) {
7479
const { edtHost } = process.env;
80+
let url;
7581
if (edtHost) {
76-
return `http://${edtHost}${this.localurl}`;
82+
url = `http://${edtHost}${this.localurl}`;
7783
} else {
7884
const { hostname, protocol } = window.location;
79-
return `${protocol}//${hostname}${this.localurl}`;
85+
url = `${protocol}//${hostname}${this.localurl}`;
8086
}
87+
if (this.isRemoteDownload) {
88+
return `${url}${this.download}`;
89+
} else return url;
8190
} else return this.link;
8291
},
8392
},

src/libs/getImage.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import isHttp from "is-http";
22

33
export default (img, isBackground, opacity, dark) => {
4-
let imagem;
4+
let image;
55
if (!img) return null;
66
const isRemote = isHttp(img);
77
if (isRemote) {
8-
imagem = img;
8+
image = img;
99
} else {
10-
imagem = require(`~/assets/images/${img}`);
10+
image = require(`~/assets/images/${img}`);
1111
}
1212
const faded = `linear-gradient(to right, rgba(${
1313
dark ? "0,0,0" : "255,255,255"
1414
}, ${opacity}) 0 100%),`;
1515
if (isBackground)
16-
return `background-image: ${opacity && faded} url("${imagem}")
16+
return `background-image: ${opacity && faded} url("${image}")
1717
1818
`;
19-
else return imagem;
19+
else return image;
2020
};

0 commit comments

Comments
 (0)