C#Æ«ÏòÓÚPascalCaseµÄÃüÃû¹æ·¶£¬¶øJavaScriptÔòÆ«ÏòÓÚcamelCaseµÄÃüÃû¹æ·¶£¬ÎªÁËÈÃJavaScript½ÓÊÕµ½µÄJSONÊý¾ÝÊÇcamelCaseµÄ£¬ÔÚGlobal.asaxÎļþÖÐÌí¼ÓÒÔϼ¸ÐдúÂ룺
var formatters = GlobalConfiguration.Configuration.Formatters; var jsonFormatter = formatters.JsonFormatter; var settings = jsonFormatter.SerializerSettings; settings.Formatting = Formatting.Indented; settings.ContractResolver = new CamelCasePropertyNamesContractResolver();¿ÉÒÔÔÚÒÔϵØÖ··ÃÎʹ¹½¨ºÃµÄWeb API£º
:8080/Help
·ÃÎÊCustomersÊý¾Ý£º
:8080/api/Customers
´´½¨×é¼þºÍAjaxHelper±¾ÎĵÄʾÀýÈÔÈ»ÊDZí¸ñ×é¼þµÄCURD£¬Ö»²»¹ýÕâ´ÎÔÛÃǵÄÊý¾ÝÊÇ´Ó·þÎñ¶Ë»ñÈ¡µÄ¡£
ÔÚʵÏÖÊý¾ÝµÄCURD֮ǰ£¬ÎÒÃÇÏÈ×¼±¸ºÃһЩ×é¼þºÍAjax°ïÖú·½·¨¡£
simple-grid×é¼þÓÃÓڰ󶨺ÍÏÔʾÊý¾Ý
<template> <table> <thead> <tr> <th v-for="col in columns"> {{ col | capitalize}} </th> </tr> </thead> <tbody> <tr v-for="(index,entry) in dataList"> <td v-for="col in columns"> {{entry[col]}} </td> </tr> </tbody> </table> </template> <script src="js/vue.js"></script> <script> Vue.component('simple-grid', { template: '#grid-template', props: ['dataList', 'columns'] }) </script> ´´½¨ºÍ×¢²ámodal-dialog×é¼þÊý¾ÝµÄн¨ºÍ±à¼½«Ê¹ÓÃģ̬¶Ô»°¿ò£¬modal-dialog×é¼þµÄ×÷ÓþÍÔÚÓÚ´Ë¡£
<template> <div> <div v-bind:class="{ 'dialog-active': show }"> <div> <div> <span @click="close"></span> </div> <slot></slot> <slot></slot> <slot></slot> </div> </div> <div></div> </div> </template> <script> Vue.component('modal-dialog', { template: '#dialog-template', props: ['show'], methods: { close: function() { this.show = false } } }) </script> AjaxHelper
¡¡