🎨
This commit is contained in:
parent
c2b1bbeec5
commit
545e83efb1
4 changed files with 64 additions and 21 deletions
18
src/client/app/common/size.ts
Normal file
18
src/client/app/common/size.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue