You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix#46
BREAKING CHANGE:
`width` and `height` attributes are now applied as-is to the `svg` element, if you want the previous, responsive behavior, use only the new `viewBox` prop instead.
Before: `width="200" height="100"`
After: `viewBox="0 0 200 100"`
Copy file name to clipboardExpand all lines: README.md
+37-14
Original file line number
Diff line number
Diff line change
@@ -66,7 +66,7 @@ import {
66
66
`ContentLoader` is a meta loader while other loaders are just higher-order components of it. By default `ContentLoader` only displays a simple rectangle, here's how you can use it to create custom loaders:
| uniqueKey | string |`randomId()`| Unique ID, you need to make it consistent for SSR |
96
-
| animate | boolean |`true`||
97
-
| 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). |
98
-
| primaryOpacity | number |`1`| Background opacity (0 = transparent, 1 = opaque) used to solve an issue in Safari |
99
-
| secondaryOpacity | number |`1`| Background opacity (0 = transparent, 1 = opaque) used to solve an issue in Safari |
| primaryColor | string |`'#f9f9f9'`| Background color |
95
+
| secondaryColor | string |`'#ecebeb'`| Highlight color |
96
+
| uniqueKey | string |`randomId()`| Unique ID, you need to make it consistent for SSR |
97
+
| animate | boolean |`true`||
98
+
| 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). |
99
+
| primaryOpacity | number |`1`| Background opacity (0 = transparent, 1 = opaque) used to solve an issue in Safari |
100
+
| secondaryOpacity | number |`1`| Background opacity (0 = transparent, 1 = opaque) used to solve an issue in Safari |
101
+
102
+
## Examples
103
+
104
+
### Responsiveness
105
+
106
+
To create a responsive loader that will follow its parent container width, use only the `viewBox` attribute to set the ratio:
107
+
108
+
```vue
109
+
<ContentLoader viewBox="0 0 300 200">
110
+
<!-- ... -->
111
+
</ContentLoader>
112
+
```
113
+
114
+
To create a loader with fixed dimensions, use `width` and `height` attributes:
115
+
116
+
```vue
117
+
<ContentLoader width="300" height="200">
118
+
<!-- ... -->
119
+
</ContentLoader>
120
+
```
121
+
122
+
Note: the exact behavior might be different depending on the CSS you apply to SVG elements.
0 commit comments