This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/vuetify/lib/components/VParallax/VParallax.js

90 lines
1.7 KiB
JavaScript
Raw Normal View History

2019-08-11 18:48:02 +00:00
// Style
import "../../../src/components/VParallax/VParallax.sass"; // Mixins
import Translatable from '../../mixins/translatable';
import mixins from '../../util/mixins';
const baseMixins = mixins(Translatable);
/* @vue/component */
export default baseMixins.extend().extend({
name: 'v-parallax',
props: {
alt: {
type: String,
default: ''
},
height: {
type: [String, Number],
default: 500
},
src: String
},
data: () => ({
isBooted: false
}),
computed: {
styles() {
return {
display: 'block',
opacity: this.isBooted ? 1 : 0,
transform: `translate(-50%, ${this.parallax}px)`
};
}
},
mounted() {
this.init();
},
methods: {
init() {
const img = this.$refs.img;
if (!img) return;
if (img.complete) {
this.translate();
this.listeners();
} else {
img.addEventListener('load', () => {
this.translate();
this.listeners();
}, false);
}
this.isBooted = true;
},
objHeight() {
return this.$refs.img.naturalHeight;
}
},
render(h) {
const imgData = {
staticClass: 'v-parallax__image',
style: this.styles,
attrs: {
src: this.src,
alt: this.alt
},
ref: 'img'
};
const container = h('div', {
staticClass: 'v-parallax__image-container'
}, [h('img', imgData)]);
const content = h('div', {
staticClass: 'v-parallax__content'
}, this.$slots.default);
return h('div', {
staticClass: 'v-parallax',
style: {
height: `${this.height}px`
},
on: this.$listeners
}, [container, content]);
}
});
//# sourceMappingURL=VParallax.js.map