In step 10, complete the Demo of the ABC (. net core) + Vue ?, Abpvue
1. Select. net core1.x
2. The Nuget restoration package requires dotnet core1.1 and so on.
3. Add an entity and add it to the context
4. Switch the cmd command line tool to the AbpCore. EntityFramewor directory of the project file, enter the dotnet ef migration add "initdata" command, and then enterDotnet ef database update: Execute to complete database generation.
6. Add the service layer corresponding to the added entity, which is a simple addition, modification, and query. The details are not described here (the api will be generated dynamically)
7. Create a controller, view, and other pages and introduce the vuejs file.
8. Obtain, add, and modify data based on dynamically generated APIs.
Js files
var _dailyMoneyService = abp.services.app.dailyMoney; var app = new Vue({ el: "#moneyApp", data: { moneyModel: { id:null, date:"", moeny: 0, desc:"" }, moneyList: [] }, methods: { getMoneyList:function() { var _this = this; _dailyMoneyService.getDailyMoneyList().done(function(result) { _this.moneyList = result; }); }, saveMoney: function () { var _this = this; _dailyMoneyService.createOrUpdateMoney(_this.moneyModel).done(function () { location.reload(); }); }, editMoney: function (id) { var _this = this; abp.ui.setBusy(); _dailyMoneyService.getMoneyForEdit(id).done(function (result) { _this.moneyModel = result; }).always(function () { abp.ui.clearBusy(); }); $('#MoneyModal').modal(); } } }); app.getMoneyList();
View
@ * For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 * {Layout = "~ /Views/Shared/_ VLayout. cshtml ";} @ section scripts {<script src = "~ /View-resources/Views/Money/Index. js "asp-append-version =" true "> </script>} <div id =" moneyApp "> <div class =" row "> <div class =" col-md-12"> <button data-toggle = "modal" data-target = "# MoneyModal" class = "btn-primary pull-right"> <I class = "fa-plus"> </I> Add a consumption record </button> </div> <div class = "row"> <table class = "table"> <thead> <tr> <th> Number </th> <th> date </th> <th> amount </th> <th> description </th> </tr> </ thead> <tbo Dy> <tr v-for = "moeny in moneyList"> <td> <a href = "javascript: void (0)" v-on: click = "editMoney (moeny. id) "> {moeny. id }}</a> </td> <td >{{ moeny. date }}</td> <td >{{ moeny. moeny }}</td> <td >{{ moeny. desc }}</td> </tr> </tbody> </table> </div> <div class = "modal fade" id = "MoneyModal" tabindex = "- 1 "role =" dialog "data-backdrop =" static "> <div class =" modal-dialog "role =" document "> <div class =" modal-content "> <form nam E = "moneyForm" role = "form" novalidate class = "form-validation"> <div class = "modal-header">
9. effect demonstration
10. If you have any questions, I don't know whether the vue meets the specifications. I feel a little confused. Please kindly advise.