| Server IP : 185.208.173.17 / Your IP : 87.236.161.98 Web Server : Microsoft-IIS/10.0 System : Windows NT SRV8576125506 10.0 build 26100 (Windows Server 2016) AMD64 User : IUSR ( 0) PHP Version : 7.4.13 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/parsmega.nuxt/node_modules/@nuxt/image/dist/runtime/components/ |
Upload File : |
<template>
<picture :key="nSources[0].src">
<source
v-if="nSources[1]"
:type="nSources[1].type"
:srcset="nSources[1].srcset"
:sizes="nSources[1].sizes"
>
<img
v-bind="nImgAttrs"
:src="nSources[0].src"
:srcset="nSources[0].srcset"
:sizes="nSources[0].sizes"
>
</picture>
</template>
<script>
import {imageMixin} from "./image.mixin";
import {getFileExtension} from "~image";
const defineComponent = (opts) => opts;
export default defineComponent({
name: "NuxtPicture",
mixins: [imageMixin],
props: {
legacyFormat: {type: String, default: null}
},
computed: {
isTransparent() {
return ["png", "webp", "gif"].includes(this.originalFormat);
},
originalFormat() {
return getFileExtension(this.src);
},
nFormat() {
if (this.format) {
return this.format;
}
if (this.originalFormat === "svg") {
return "svg";
}
return "webp";
},
nLegacyFormat() {
if (this.legacyFormat) {
return this.legacyFormat;
}
const formats = {
webp: this.isTransparent ? "png" : "jpeg",
svg: "png"
};
return formats[this.nFormat] || this.originalFormat;
},
nSources() {
if (this.nFormat === "svg") {
return [{
srcset: this.src
}];
}
const formats = this.nLegacyFormat !== this.nFormat ? [this.nLegacyFormat, this.nFormat] : [this.nFormat];
const sources = formats.map((format) => {
const {srcset, sizes, src} = this.$img.getSizes(this.src, {
...this.nOptions,
sizes: this.sizes || this.$img.options.screens,
modifiers: {
...this.nModifiers,
format
}
});
return {
src,
type: `image/${format}`,
sizes,
srcset
};
});
return sources;
}
},
created() {
if (process.server && process.static) {
this.nSources;
}
}
});
</script>