Vue demo

vue

<div id="app">

<table class="table table-bordered">

<tr v-for="item in workFlow">

<td>

{{item.name}}

</td>

<td>

{{getNodeStr(item.nodes)}}

</td>

<td>

<button class="btn btn-primary" v-on:click="editWorkFlow(item)">修改</button><button class="btn btn-primary">查看</button>

</td>

</tr>

</table>

</div>

@section scripts{

<script>

var app = new Vue({

el: '#app',

data: {

workFlow: [

{

name: "审核",

nodes: [

{

name:"一审"

},

{

name:"二审"

}

]

}

]

},

methods: {

init: function () {

var that = this;

$.ajax({

url: 'getworkflowlist',

success: function (data) {

that.workFlow = data;

}

});

},

getNodeStr: function (nodes) {

var str = '';

for (var i = 0; i < nodes.length; i++) {

str += nodes[i].name+'->';

}

return str;

},

editWorkFlow: function (value) {

alert(value.name);

}

},

mounted() {

this.init();

},

computed: {

},

watch: {

}

})

</script>

}

以上是 Vue demo 的全部内容, 来源链接: utcz.com/z/379057.html

回到顶部