isdaviddong
1/13/2017 - 3:07 AM

AddNewOrUpdate.html

<html>
<head>
    <title>AspNetWithVueBinding </title>
    <script src="Scripts/jquery-1.9.1.min.js"></script>
    <script src="Scripts/vue.min.js"></script>
    <script src="Scripts/isRockFx.js"></script>
    <link href="Content/bootstrap.min.css" rel="stylesheet" />
    <script src="Scripts/utility.js"></script>
    <script>
        Vue.config.debug = true;        //vue debug mode
        Vue.config.devtools = true;     //vue debug mode
        var guid = getQueryString('guid');  //取得guid
        var vd_StudentRec= { StudentName: '', Height: 0, Weight: 0 }; //儲存資料的前端object
        var vm_StudentRec; //Vue instance
        //設定資料繫結
        function SetBinding() {
            //create vue instance
            vm_StudentRec = new Vue(
                        {
                            el: '#Form_StudentRec',
                            data: { rec: vd_StudentRec },
                        });
        }
       
      //...略...
      //...略...
      //...略...
      
        //ready
        $(function () {
            SetBinding();   //設定繫結
            //如果有QueryString則載入特定資料
            if (guid != null)
            {
                //依照QueryString guid 載入特定資料
                LoadData(guid); 
            }
            //Button Event Hook
            $('#ButtonAddNewOrUpdate').click(AddNewOrUpdate);
            $('#ButtonClear').click(Clear);
        });
    </script>
</head>
<body>
      //...略...
      //...略...
      //...略...
</body>
</html>