работать с dom напрямую плохая практика
props: [ 'items', 'value' ],
data: () => ({
sliderStyles: null,
}),
<ul class="tabs">
<li
v-for="n in items"
:key="n.value"
@click="$emit('input', n.value)"
class="tabs-item"
>{{ n.text }}</li>
</ul>
<div
class="tabs-slider"
:style="sliderStyles"
></div>
.tabs-slider
) зададим абсолютное позиционирование и transition.mounted() {
this.$watch(
'value',
value => {
const index = this.items.findIndex(n => n.value === value);
const el = this.$el.querySelectorAll('.tabs-item')[index];
this.sliderStyles = el
? {
left: `${el.offsetLeft}px`,
width: `${el.offsetWidth}px`,
}
: null;
},
{
immediate: true,
}
);
},
const getSrc = img => img.getAttribute('src');
// или
const getSrc = img => img.attributes.src.value;
const relativeOnly = f => img => {
const src = getSrc(img);
if (!/^https?:\/\//.test(src)) {
f(img, src);
}
};
document.querySelectorAll('img').forEach(relativeOnly((img, src) =>
img.outerHTML = `
<picture>
<source srcset="${src}" type="image/svg+xml">
${img.outerHTML}
</picture>`
));
const wrapImages = relativeOnly((img, src) => {
const picture = document.createElement('picture');
const source = document.createElement('source');
source.srcset = src;
source.type = 'image/svg+xml';
img.replaceWith(picture);
picture.append(source, img);
});
for (const n of document.getElementsByTagName('img')) {
wrapImages(n);
}
// или
Array.prototype.forEach.call(document.images, wrapImages);
<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))$">
*.init.js
файлы. element.style.transition = tempTime + "ms all";
element.style.transform = 'translateX(' + getRandomInt(-animated.getBoundingClientRect().width / size, animated.getBoundingClientRect().width / size) + 'px) translateY(' + getRandomInt(-animated.getBoundingClientRect().height / size, animated.getBoundingClientRect().height / size) + 'px)';
setTimeout(() => { element.style.transition = tempTime / 2 + "ms all"; }, 0)
dependencies
подключаете все, что будет использоваться в продакшне. Ваш конечный юзер у себя в браузере увидит работу reset-css
— значит в dependencies
.devDependencies
все, что в продакшне напрямую не используется. Например, typescript или node-sass, которые нужены только на этапе сборки.