-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (28 loc) · 823 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// import TruncateReadMore from './src/TruncateReadMore.vue';
// const plugin = {
// install: (app) => {
// app.component('TruncateReadMore', TruncateReadMore)
// },
// }
// export default plugin
import TruncateReadMore from './src/TruncateReadMore.vue';
const install = (app, options) => {
if (app.version.startsWith('2.')) {
// Vue 2 installation
const Vue = app;
const componentConfig = {
...TruncateReadMore,
install: undefined,
};
Vue.component('TruncateReadMore', componentConfig);
} else if (app.version.startsWith('3.')) {
// Vue 3 installation
app.component('TruncateReadMore', TruncateReadMore);
} else {
console.error('This plugin is only compatible with Vue 2.x and Vue 3.x.');
}
};
export default {
install,
};
export { TruncateReadMore };