码迷,mamicode.com
首页 > 其他好文 > 详细

Vue demo

时间:2020-01-16 19:16:58      阅读:74      评论:0      收藏:0      [点我收藏+]

标签:rip   dem   data   length   compute   new   turn   color   init   

<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

标签:rip   dem   data   length   compute   new   turn   color   init   

原文地址:https://www.cnblogs.com/herocany/p/12202478.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!