Skip to content

Commit 1005b46

Browse files
committed
Improve imports / exports
1 parent 0dc5641 commit 1005b46

File tree

8 files changed

+17
-20
lines changed

8 files changed

+17
-20
lines changed

dev/serve.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script>
22
import Vue from 'vue';
3-
import ExpandingList from '@/ExpandingList';
4-
import VirtualScroll from '@/VirtualScroll';
3+
import ExpandingList from '@/components/ExpandingList';
4+
import VirtualScroll from '@/components/VirtualScroll';
55
66
export default Vue.extend({
77
name: 'ServeDev',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-windowing",
3-
"version": "0.4.0",
3+
"version": "0.5.0",
44
"description": "",
55
"main": "dist/vue-windowing.ssr.js",
66
"browser": "dist/vue-windowing.esm.js",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</template>
2323

2424
<script>
25-
import VirtualScroll from '@/VirtualScroll';
25+
import VirtualScroll from '@/components/VirtualScroll';
2626
2727
export default {
2828
name: 'ExpandingList',
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</template>
2020

2121
<script>
22-
import VirtualScroll from '@/VirtualScroll';
22+
import VirtualScroll from '@/components/VirtualScroll';
2323
2424
export default {
2525
name: 'NestedList',
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</template>
2727

2828
<script>
29-
import AutoHeightMeasurer from '@/AutoHeightMeasurer';
29+
import AutoHeightMeasurer from '@/components/AutoHeightMeasurer';
3030
3131
export default {
3232
name: 'VirtualScroll',

src/components/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export { default as VirtualScroll } from './VirtualScroll';
2+
export { default as AutoHeightMeasurer } from './AutoHeightMeasurer';
3+
export { default as ExpandingList } from './ExpandingList';
4+
export { default as NestedList } from './NestedList';

src/entry.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
// Import vue component
2-
import VirtualScroll from '@/VirtualScroll';
3-
import AutoHeightMeasurer from '@/AutoHeightMeasurer';
4-
import ExpandingList from '@/ExpandingList';
5-
import NestedList from '@/NestedList';
2+
import * as components from '@/components/index';
63

74
// install function executed by Vue.use()
85
const install = function installVueWindowing(Vue) {
96
if (install.installed) return;
107
install.installed = true;
11-
Vue.component('VirtualScroll', VirtualScroll);
12-
Vue.component('AutoHeightMeasurer', AutoHeightMeasurer);
13-
Vue.component('ExpandingList', ExpandingList);
14-
Vue.component('NestedList', NestedList);
8+
9+
Object.entries(components).forEach(([componentName, component]) => {
10+
Vue.component(componentName, component);
11+
});
1512
};
1613

1714
// Create module definition for Vue.use()
@@ -34,13 +31,9 @@ if (process.env.ES_BUILD === 'false') {
3431
}
3532
}
3633

37-
// Inject install function into component - allows component
38-
// to be registered via Vue.use() as well as Vue.component()
39-
component.install = install;
40-
41-
// Export component by default
42-
export default component;
34+
export default plugin;
4335

4436
// It's possible to expose named exports when writing components that can
4537
// also be used as directives, etc. - eg. import { RollupDemoDirective } from 'rollup-demo';
4638
// export const RollupDemoDirective = component;
39+
export * from '@/components/index';

0 commit comments

Comments
 (0)