From 545e83efb1da11fa435f3aaaa6f6ec0d168cedb8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 16 Feb 2019 08:51:35 +0900 Subject: [PATCH] :art: --- src/client/app/common/size.ts | 18 ++++++ .../app/common/views/components/user-list.vue | 62 ++++++++++++------- src/client/app/init.ts | 2 + .../mobile/views/components/ui-container.vue | 3 + 4 files changed, 64 insertions(+), 21 deletions(-) create mode 100644 src/client/app/common/size.ts diff --git a/src/client/app/common/size.ts b/src/client/app/common/size.ts new file mode 100644 index 0000000000..6abb305747 --- /dev/null +++ b/src/client/app/common/size.ts @@ -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); + } + } + } + }); + } +}; diff --git a/src/client/app/common/views/components/user-list.vue b/src/client/app/common/views/components/user-list.vue index 35569687ba..3147fbe371 100644 --- a/src/client/app/common/views/components/user-list.vue +++ b/src/client/app/common/views/components/user-list.vue @@ -1,12 +1,17 @@