commit | author | age
|
9bcb19
|
1 |
import events from './events' |
I |
2 |
import MultiTab from './MultiTab' |
|
3 |
import './index.less' |
|
4 |
|
|
5 |
const api = { |
|
6 |
/** |
|
7 |
* open new tab on route fullPath |
|
8 |
* @param config |
|
9 |
*/ |
|
10 |
open: function (config) { |
|
11 |
events.$emit('open', config) |
|
12 |
}, |
|
13 |
rename: function (key, name) { |
|
14 |
events.$emit('rename', { key: key, name: name }) |
|
15 |
}, |
|
16 |
/** |
|
17 |
* close current page |
|
18 |
*/ |
|
19 |
closeCurrentPage: function () { |
|
20 |
this.close() |
|
21 |
}, |
|
22 |
/** |
|
23 |
* close route fullPath tab |
|
24 |
* @param config |
|
25 |
*/ |
|
26 |
close: function (config) { |
|
27 |
events.$emit('close', config) |
|
28 |
} |
|
29 |
} |
|
30 |
|
|
31 |
MultiTab.install = function (Vue) { |
|
32 |
if (Vue.prototype.$multiTab) { |
|
33 |
return |
|
34 |
} |
|
35 |
api.instance = events |
|
36 |
Vue.prototype.$multiTab = api |
|
37 |
Vue.component('multi-tab', MultiTab) |
|
38 |
} |
|
39 |
|
|
40 |
export default MultiTab |