generated from voorhoede/open-source-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# App Image | ||
Extension of the native `<img>` element. When loading images it is important to load assets matching the needed size, this is done using the `loader` prop and setting `sizes`. | ||
|
||
## Usage | ||
### Image with fixed size | ||
```vue | ||
<app-image | ||
src="/example.jpg" | ||
:width="754" | ||
:height="552" | ||
alt="An example" | ||
/> | ||
``` | ||
|
||
### Image with responsive size | ||
```vue | ||
<app-image | ||
src="/example.jpg" | ||
:width="754" | ||
:height="552" | ||
alt="An example" | ||
sizes="100vw" | ||
/> | ||
``` | ||
|
||
### With loader | ||
Pass `loader` function to resolve `src` to optimized URLs. | ||
```vue | ||
<app-image | ||
src="/example.jpg" | ||
:width="754" | ||
:height="552" | ||
alt="An example" | ||
sizes="100vw" | ||
:loader="({ src, width }) => `${src}?width=${width}`" | ||
/> | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
# Image component | ||
Image component to fetch optimized images from a CDN. | ||
|
||
Extension of the native `<img>` element. When loading images it is important to load assets matching the needed size, this is done using the `loader` prop and setting `sizes`. | ||
|
||
## Niceness | ||
- No client-side JavaScript | ||
- Generate `srcset` from native `sizes` attribute | ||
|