8000 feat(Avatar): add `referrerpolicy` prop to img tag by sduduzog · Pull Request #392 · nuxt/ui · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(Avatar): add referrerpolicy prop to img tag #392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/runtime/components/elements/Avatar.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<template>
<span :class="wrapperClass">
<img v-if="url && !error" :class="avatarClass" :src="url" :alt="alt" : => onError()">
<img
v-if="url && !error"
:class="avatarClass"
:src="url"
:alt="alt"
: => onError()"
:referrerpolicy="referrerpolicy"
>
<span v-else-if="text || placeholder" :class="ui.placeholder">{{ text || placeholder }}</span>

<span v-if="chipColor" :class="chipClass">
Expand Down Expand Up @@ -32,6 +39,10 @@ export default defineComponent({
type: String,
default: null
},
referrerpolicy: {
type: String as PropType<'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url'>,
default: () => 'strict-origin-when-cross-origin'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why set a default here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going off of the mdn docs. I just checked this out and looks like even when the props is null or undefined, the default is still part of the headers request.

},
text: {
type: String,
default: null
Expand Down
0