zoukankan      html  css  js  c++  java
  • 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 = this
                    this.$axios.request({
                        url:'http://127.0.0.1:8001/test/',
                        method:'get'
                    }).then(function (response) {
                        _this.course=response.data
                    })
    
                }
    
            }
        }
    </script>
    
  • 相关阅读:
    poj3686 Windys
    poj3155 Hard Life
    luoguP2774 方格取数问题
    poj3469 Dual Core CPU
    poj3281 Dining
    luogu P3410 拍照
    离散化
    最短路(SPFA)
    lower_bound && upper_bound
    gcd
  • 原文地址:https://www.cnblogs.com/jianhaozhou/p/10156345.html
Copyright © 2011-2022 走看看