我正在尝试在Kendo树视图节点中添加多个按钮.我使用模板添加多个按钮,但由于整个节点正在处理链接,因此无法实现其功能.请在下面找到HTML和JS
HTML
<div kendo-tree-view="tree" k-data-source="treeData" class="hasMenu" k-on-change="selectedItem = dataItem">
<span k-template>
{{dataItem.text}}
<i class="fa fa-plus" aria-hidden="true"></i>
<i class="fa fa-trash" aria-hidden="true"></i>
</span>
</div>
Run Code Online (Sandbox Code Playgroud)
JS
$scope.treeData = new kendo.data.HierarchicalDataSource(
{
data: [
{
text: "My Product",
items: [
{
text: "Building Materials",
items: [
{ text: "Lumber & Composites" },
{ text: "Molding" },
{ text: "Drywall" },
{ text: "Doors" }
]
},
{ text: "Decor" },
{ text: "Chemicals" },
{ text: "Hardware" },
{ text: "Lighting & Fixtures" }, …Run Code Online (Sandbox Code Playgroud) 我有一个复选框数组,它们来自存储所有系统设置的主系统对象。(称为getSystem {})。
我以这种形式访问具有一系列角色[]的用户。如何对照getSystem.user_roles检查此角色数组?
我知道如何正常做,显然是在javascript中。但是我应该在复选框输入Vue.js中添加什么呢?
<b-form-group>
<label for="company">Email Address</label>
<b-form-input type="text" id="email" v-model="user.email" placeholder="Enter a valid e-mail"></b-form-input>
</b-form-group>
// Here i can do user.roles to get the array of roles.
// What can I do to loop through the roles and check the box if it exists in the user roles??
<b-form-group v-for="resource, key in getSystem.user_roles" v-if="getSystem.user_roles">
<label>{{resource.role_name}}</label>
<input type="checkbox" [ what do I put here to compare against user.roles, and check the box if exists??] >
</b-form-group>
Run Code Online (Sandbox Code Playgroud)