今 天又學習一門前端,叫Vue.js。
在VS中,使用NuGet下載Vue.js和axios.js:
引用至html網頁中:
在script里,寫幾行讀數據接口的代碼:

new Vue({ el: '#app', data() { return { info: null } }, mounted() { axios .post('/api/Content/GetAboutContent', { Parmkey: 0 }) .then(response => (this.info = response.data.Content)) .catch(function (error) { console.log(error); }); } })
以上,一處為接口路徑,一處為POST傳入參數。
在網頁呈現html內容:
下面是顯示效果與數據庫存儲的html內容: