首页 > 其他 > 详细

Vue demo

时间:2020-01-16 18:35:05      阅读:71      评论:0      收藏:0      [点我收藏+]
<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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!