Skip to content

Commit ca76233

Browse files
MLDMoritzegoist
authored andcommitted
fix: fixes issues with iOS (#22)
* Fixes #14 * Update README.md * Update README.md
1 parent 69f1baf commit ca76233

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ You can also use the [online tool](https://create-vue-content-loader.netlify.com
9191
|secondaryColor|string|`'#ecebeb'`||
9292
|uniqueKey|string|`randomId()`|Unique ID, you need to make it consistent for SSR|
9393
|animate|boolean|`true`||
94+
|baseUrl|string|empty string|Required if you're using <base url="/" /> in your <head/>. Defaults to an empty string. This prop is common used as: <content-loader :base-url="$route.fullPath" /> which will fill the SVG attribute with the relative path. Related [#14](https://github.com/egoist/vue-content-loader/issues/14).|
95+
|primaryOpacity|number|`1`|Background opacity (0 = transparent, 1 = opaque) used to solve an issue in Safari|
96+
|secondaryOpacity|number|`1`|Background opacity (0 = transparent, 1 = opaque) used to solve an issue in Safari|
97+
9498

9599
## Credits
96100

src/ContentLoader.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ export default {
2222
type: String,
2323
default: 'xMidYMid meet'
2424
},
25+
baseUrl: {
26+
type: String,
27+
default: ''
28+
},
2529
primaryColor: {
2630
type: String,
2731
default: '#f9f9f9'
@@ -30,6 +34,14 @@ export default {
3034
type: String,
3135
default: '#ecebeb'
3236
},
37+
primaryOpacity: {
38+
type: Number,
39+
default: 1
40+
},
41+
secondaryOpacity: {
42+
type: Number,
43+
default: 1
44+
},
3345
uniqueKey: {
3446
type: String
3547
},
@@ -51,8 +63,8 @@ export default {
5163
preserveAspectRatio={props.preserveAspectRatio}
5264
>
5365
<rect
54-
style={{ fill: `url(#${idGradient})` }}
55-
clip-path={`url(#${idClip})`}
66+
style={{ fill: `url(${props.baseUrl}#${idGradient})` }}
67+
clip-path={`url(${props.baseUrl}#${idClip})`}
5668
x="0"
5769
y="0"
5870
width={props.width}
@@ -74,7 +86,7 @@ export default {
7486
</clipPath>
7587

7688
<linearGradient id={idGradient}>
77-
<stop offset="0%" stop-color={props.primaryColor}>
89+
<stop offset="0%" stop-color={props.primaryColor} stop-opacity={props.primaryOpacity}>
7890
{props.animate ? (
7991
<animate
8092
attributeName="offset"
@@ -84,7 +96,7 @@ export default {
8496
/>
8597
) : null}
8698
</stop>
87-
<stop offset="50%" stop-color={props.secondaryColor}>
99+
<stop offset="50%" stop-color={props.secondaryColor} stop-opacity={props.secondaryOpacity}>
88100
{props.animate ? (
89101
<animate
90102
attributeName="offset"
@@ -94,7 +106,7 @@ export default {
94106
/>
95107
) : null}
96108
</stop>
97-
<stop offset="100%" stop-color={props.primaryColor}>
109+
<stop offset="100%" stop-color={props.primaryColor} stop-opacity={props.primaryOpacity}>
98110
{props.animate ? (
99111
<animate
100112
attributeName="offset"

0 commit comments

Comments
 (0)