Vue demo
Posted herocany
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Vue demo相关的知识,希望对你有一定的参考价值。
<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的主要内容,如果未能解决你的问题,请参考以下文章