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
- 下一篇: 前端框架_Vue