isdaviddong
1/10/2017 - 11:39 AM

index.html

<script>
    var vd_StudentInfo; //儲存資料
    var vm_StudentInfo; //Vue instance

    //設定資料繫結
    function SetBinding() {
        //create vue instance
        vm_StudentInfo = new Vue(
                    {
                        el: '#tableBody',
                        data: { items: vd_StudentInfo },
                        methods: {
                            remove: function (item) {
                                if (confirm('確定要刪除[' + item.StudentName + ']?')) {
                                    Remove(item);
                                }
                            },
                            edit: function (item) {
                                window.location.href = 'AddNewOrUpdate.html?guid=' + item.guid;
                            }
                        }
                    });
    }

    //移除一筆資料
    function Remove(item) {
        var para = item.guid;
        ExecuteAPI('Example', 'Remove', para,
            //success
            function (result) {
                if (result.isSuccess) {
                    //重新取得資料
                    GetData();
                }
            }
            );
    }
    
    //...略...
    //...略...
    //...略...