@@ -74,13 +86,31 @@ export default {
data() {
return {
expandedArray: [],
- tData: []
+ tData: [],
+ showSearchInput: false,
+ key: ''
+ }
+ },
+ watch: {
+ key(val) {
+ this.$refs.myDsTree.filter(val)
}
},
mounted() {
this.queryTreeDatas()
},
methods: {
+ filterNode(value, data) {
+ if (!value) return true
+ return data.name.indexOf(value) !== -1
+ },
+ showSearchWidget() {
+ this.showSearchInput = true
+ },
+ closeSearchWidget() {
+ this.key = ''
+ this.showSearchInput = false
+ },
queryTreeDatas() {
listDatasource().then(res => {
this.tData = this.buildTree(res.data)