aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/components/index.ts
diff options
context:
space:
mode:
authorZero~Informatique2019-12-21 03:32:20 +0100
committerZero~Informatique2019-12-21 03:32:20 +0100
commit6e7ee4d38fb3630a13d31592f0f6ae9bbe8e1bd6 (patch)
tree88ebce4634d26daa80718ab1526c728f55a983f0 /viewer/src/components/index.ts
parent62005141132da1e9761598fa3e4b35b4dab38a89 (diff)
downloadldgallery-6e7ee4d38fb3630a13d31592f0f6ae9bbe8e1bd6.tar.gz
Implemented global components registration
Moved the fullscreen button as a global component (as demonstration) Improved the layout CSS
Diffstat (limited to 'viewer/src/components/index.ts')
-rw-r--r--viewer/src/components/index.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/viewer/src/components/index.ts b/viewer/src/components/index.ts
new file mode 100644
index 0000000..1406b34
--- /dev/null
+++ b/viewer/src/components/index.ts
@@ -0,0 +1,22 @@
1import Vue from 'vue'
2
3const requireComponent = require.context(
4 '@/components',
5 false, // Whether or not to look in subfolders
6 // The regular expression used to match base component filenames
7 /Ld[A-Z]\w+\.vue$/
8)
9
10requireComponent.keys().forEach(fileName => {
11 const componentConfig = requireComponent(fileName)
12 const componentName = fileName.split('/').pop()!.replace(/\.vue$/, '');
13
14 // Register component globally
15 Vue.component(
16 componentName,
17 // Look for the component options on `.default`, which will
18 // exist if the component was exported with `export default`,
19 // otherwise fall back to module's root.
20 componentConfig.default || componentConfig
21 )
22}) \ No newline at end of file