|
5 | 5 | 'has-selectable-control': isMultiple || showSelectController,
|
6 | 6 | 'is-root': currentDeep === 1,
|
7 | 7 | 'is-selectable': selectable,
|
| 8 | + 'is-selected': isSelected, |
8 | 9 | 'is-mouseover': isMouseover
|
9 | 10 | }"
|
10 | 11 | @click.stop="handleClick($event, 'tree')"
|
|
22 | 23 | :data="data"
|
23 | 24 | :show-length="showLength"
|
24 | 25 | :show-comma="notLastKey">
|
25 |
| - <span v-if="currentDeep > 1 && !Array.isArray(parentData)">{{ keyFormatter(currentKey) }}:</span> |
| 26 | + <span v-if="currentDeep > 1 && !Array.isArray(parentData)" class="vjs-key">{{ keyFormatter(currentKey) }}:</span> |
26 | 27 | </brackets-left>
|
27 | 28 |
|
28 | 29 | <!-- 数据内容, data 为对象时, key 表示键名, 为数组时表示索引 -->
|
|
66 | 67 | :parent-data="parentData"
|
67 | 68 | :data="data"
|
68 | 69 | :current-key="currentKey">
|
69 |
| - <span v-if="!Array.isArray(parentData)">{{ keyFormatter(currentKey) }}:</span> |
| 70 | + <span v-if="!Array.isArray(parentData)" class="vjs-key">{{ keyFormatter(currentKey) }}:</span> |
70 | 71 | </simple-text>
|
71 | 72 | </div>
|
72 | 73 | </template>
|
|
205 | 206 | return this.selectableType === 'single'
|
206 | 207 | },
|
207 | 208 |
|
| 209 | + isSelected () { |
| 210 | + if (this.isMultiple) { |
| 211 | + return this.model.includes(this.path) |
| 212 | + } else if (this.isSingle) { |
| 213 | + return this.model === this.path |
| 214 | + } else { |
| 215 | + return false |
| 216 | + } |
| 217 | + }, |
| 218 | +
|
208 | 219 | propsError () {
|
209 | 220 | const error = this.selectableType && !this.selectOnClickNode && !this.showSelectController
|
210 | 221 | return error ? 'When selectableType is not null, selectOnClickNode and showSelectController cannot be false at the same time, because this will cause the selection to fail.' : ''
|
|
0 commit comments