This commit is contained in:
梁灏 2017-04-27 13:56:58 +08:00
parent 05e2dda017
commit 69a10b78f7
3 changed files with 138 additions and 49 deletions

View file

@ -1,5 +1,5 @@
<template>
<Tree :data="baseData" @on-check-change="handleSelectChange" show-checkbox></Tree>
<Tree :data="baseData" show-checkbox @on-check-change="handleChange" ></Tree>
</template>
<script>
export default {
@ -8,55 +8,30 @@
bd: [],
baseData: [
{
title: 'parent',
id: '1-0',
expand: true,
title: 'parent 1',
children: [{
title: 'parent 1-0',
expand: true,
// disabled: true,
// checked: true,
children: [
{
title: 'leaf',
checked: true,
selected: true
},
{
title: 'leaf',
checked: false
}
]
}, {
title: 'parent 1-1',
expand: true,
checked: true,
children: [
{
title: '<span style="color: red">leaf</span>',
checked: false
}
]
}]
},
{
expand: true,
title: 'parent 1',
children: [{
title: 'parent 1-0',
expand: true,
children: [{
title: 'leaf'
}, {
title: 'leaf',
}]
}, {
title: 'parent 1-1',
expand: true,
checked: true,
children: [{
title: '<span style="color: red">leaf</span>',
}]
}]
children: [
{
title: 'child1',
id: '1-1',
expand: true,
children: [
{
title: 'child1-1-1',
id: '1-1-1'
},
{
title: 'child1-1-2',
id: '1-1-2'
}
]
},
{
title: 'child2',
id: '1-2'
}
]
}
]
}
@ -64,7 +39,18 @@
methods: {
handleSelectChange (data) {
console.log(data);
},
updateTree (data) {
data[0].children[0].checked = true;
// data[0].children[0].children[0].checked = true;
// data[0].children[0].children[1].checked = true;
},
handleChange () {
console.log(1)
}
},
mounted () {
this.updateTree(this.baseData);
}
}
</script>

View file

@ -119,6 +119,14 @@
this.$on('on-checked', () => {
this.$emit('on-check-change', this.getCheckedNodes());
});
},
watch: {
data () {
this.$nextTick(() => {
this.updateData();
this.broadcast('TreeNode', 'indeterminate');
})
}
}
};
</script>

95
src/locale/lang/ja-JP.js Normal file
View file

@ -0,0 +1,95 @@
export default {
i: {
select: {
placeholder: '選んでください',
noMatch: 'マッチするデータなし'
},
table: {
noDataText: 'データなし',
noFilteredDataText: 'スクリーニングしたデータなし',
confirmFilter: 'スクリーニング',
resetFilter: 'リセット',
clearFilter: '全部'
},
datepicker: {
selectDate: '日時を選んでください',
selectTime: '時間を選んでください',
startTime: 'スタート時間',
endTime: '終了時間',
clear: 'クリーア',
ok: '確定',
month: '月',
month1: '1 月',
month2: '2 月',
month3: '3 月',
month4: '4 月',
month5: '5 月',
month6: '6 月',
month7: '7 月',
month8: '8 月',
month9: '9 月',
month10: '10 月',
month11: '11 月',
month12: '12 月',
year: '年',
weeks: {
sun: '日',
mon: '月',
tue: '火',
wed: '水',
thu: '木',
fri: '金',
sat: '土'
},
months: {
m1: '1月',
m2: '2月',
m3: '3月',
m4: '4月',
m5: '5月',
m6: '6月',
m7: '7月',
m8: '8月',
m9: '9月',
m10: '10月',
m11: '11月',
m12: '12月'
}
},
transfer: {
titles: {
source: 'ソースリスト',
target: 'ターゲットリスト'
},
filterPlaceholder: '検索内容を入力ください',
notFoundText: '内容が見つかってなかった'
},
modal: {
okText: '確定',
cancelText: 'キャンセル'
},
poptip: {
okText: '確定',
cancelText: 'キャンセル'
},
page: {
prev: '前へ',
next: '次へ',
total: '全部',
item: '件',
items: '件',
prev5: '前の5ページへ',
next5: '次の5ページへ',
page: '件/ページ',
goto: '',
p: 'ページ目へ'
},
rate: {
star: '点',
stars: '点'
},
tree: {
emptyText: 'データなし'
}
}
};