mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-17 23:47:38 -07:00
19 lines
357 B
TypeScript
19 lines
357 B
TypeScript
|
export default {
|
||
|
install(Vue) {
|
||
|
Vue.directive('size', {
|
||
|
inserted(el, binding) {
|
||
|
const query = binding.value;
|
||
|
const width = el.clientWidth;
|
||
|
for (const q of query) {
|
||
|
if (q.lt && (width <= q.lt)) {
|
||
|
el.classList.add(q.class);
|
||
|
}
|
||
|
if (q.gt && (width >= q.gt)) {
|
||
|
el.classList.add(q.class);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
};
|