当我向组件添加数据目标时,它会停止显示元素。我尝试过对一个ID进行编码,但无论我做什么,它都会显示数据目标:
Vue.component('kk-directory', {
props: ['directoryData'],
template: '<li>'+
'<input type="checkbox" v-model="directoryData.Selected" v-on:change=" $root.selectedChange(directoryData)" v-show="!directoryData.Migrate">'+
'<span class="glyphicon glyphicon-check" ng-click="selectChilds(directoryData)"></span>'+
'<a href="#" v-on:click="!directoryData.Loaded && $root.add(directoryData)" data-toggle="collapse" **:data-target="#'+'{{directoryData.DirectoryId}}">**'+
'<b>{{ directoryData.Name }}:</b>'+
'<span>files({{ directoryData.FileCountCurrentFolder }})</span>, files total (<span ng-class="{\'danger\': directoryData.FileCountTotal > 5000}">{{ directoryData.FileCountTotal }}</span>), <span>GB ({{ directoryData.SizeGB }})</span>'+
'</a>'+
'<ul id="{{directoryData.DirectoryId}}" class="">'+
'<li v-for="dir in directoryData.Childs">'+
'<kk-directory :directory-data="dir"></kk-directory >'+
'</li>'+
'</ul>'+
'</li>'
})
是否无法在组件中绑定数据目标?
答案 0 :(得分:0)
我明白了。以下工作:
'<a href="#" v-on:click="!directoryData.Loaded && $root.add(directoryData)" data-toggle="collapse" :data-target="\'#d\'+directoryData.DirectoryId">'