vue操作,显示数据
生活随笔
收集整理的這篇文章主要介紹了
vue操作,显示数据
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
vue操作,顯示數據
1.操作頁面上的數據
組件中的內容
<template><div class="about"><h1>這是課程頁面</h1><button @click="test">點我</button><p><button @click="data1">得數據</button></p><p>{{course}}</p></div> </template>操作組件中的數據
//頁面上的{{course}}數據 //在script中操作 <script>export default {//data為操作數據的字段data:function(){return {course:['treadf']}},//methods為操作方法的字段methods:{test:function () {alert('test')},data1:function () {let _this = thisthis.$axios.request({url:'http://127.0.0.1:8001/test/',method:'get'}).then(function (response) {_this.course=response.data})}}} </script>轉載于:https://www.cnblogs.com/jianhaozhou/p/10156345.html
總結
以上是生活随笔為你收集整理的vue操作,显示数据的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Zabbix4.0 for Postg
- 下一篇: Butterknife 的简单使用 和