Skip to content

Commit

Permalink
feat: 注册组件时可以设置默认折叠状态 (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
eviIIt authored Mar 19, 2020
1 parent 277ed22 commit 87e93c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/el-data-tree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,9 @@ export default {
*/
collapsable: {
type: Boolean,
default: false
default() {
return _get(this, '$elDataTreeOptions.collapsable') || false
}
}
},
data() {
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import Component from './el-data-tree.vue'
// the same plugin more than once,
// so calling it multiple times on the same plugin
// will install the plugin only once
Component.install = Vue => {
Component.install = (Vue, options = {}) => {
Vue.prototype.$elDataTreeOptions = options
Vue.component(Component.name, Component)
}

Expand Down

0 comments on commit 87e93c5

Please sign in to comment.