mirror of
https://github.com/KevinMidboe/seasoned.git
synced 2026-03-11 20:05:39 +00:00
version 1.0
This commit is contained in:
19
src/directives/v-image.js
Normal file
19
src/directives/v-image.js
Normal file
@@ -0,0 +1,19 @@
|
||||
let setValue = function(el, binding) {
|
||||
let img = new Image();
|
||||
img.src = binding.value;
|
||||
|
||||
img.onload = function() {
|
||||
this.src = img.src;
|
||||
this.classList.add("is-loaded");
|
||||
}.bind(el);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
isLiteral: true,
|
||||
bind(el, binding){
|
||||
setValue(el, binding);
|
||||
},
|
||||
update(el, binding){
|
||||
setValue(el, binding);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user