mirror of
https://github.com/KevinMidboe/seasonedRequest.git
synced 2026-01-28 20:26:28 +00:00
version 1.0
This commit is contained in:
15
src/directives/v-formatDate.js
Normal file
15
src/directives/v-formatDate.js
Normal file
@@ -0,0 +1,15 @@
|
||||
let setValue = function(el, binding) {
|
||||
let value = binding.value;
|
||||
let dateArray = value.split('-');
|
||||
let monthsArray = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec'];
|
||||
el.innerText = `${dateArray[2]} ${monthsArray[+dateArray[1] - 1]} ${dateArray[0]}`;
|
||||
};
|
||||
module.exports = {
|
||||
isLiteral: true,
|
||||
bind(el, binding) {
|
||||
setValue(el, binding);
|
||||
},
|
||||
update(el, binding) {
|
||||
setValue(el, binding);
|
||||
}
|
||||
}
|
||||
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