Vue之axios异步通信

 

 

 

 

 

 

 

 

 

 

 

 

 

   代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=<device-width>, initial-scale=1.0">
    <script crossorigin="anonymous" integrity="sha512-BKbSR+cfyxLdMAsE0naLReFSLg8/pjbgfxHh/k/kUC82Hy7r6HtR5hLhobaln2gcTvzkyyehrdREdjpsQwy2Jw==" src="https://lib.baomitu.com/vue/2.6.12/vue.min.js"></script>
    <title>Document</title>
</head>
<body>
    <!-- view -->
    <div id="app"> 
        <h1>{{f1()}}</h1>
        <h1>{{f2}}</h1>
    </div>
   
    <!-- viewmodel -->
    <script>
        var vm  = new Vue({
            el:"#app",
            data: {
                message:"lbwnb"
            },
            methods: {
                f1:function(){
                    return "f1的时间是:"+Date.now();
                }
            },
            computed: {
                f2:function(){
                    this.message;
                    return "f2的时间是:"+Date.now();
                }
            }
        });
    </script>
</body>
</html>

 

posted @ 2020-12-11 21:24  爱编程DE文兄  阅读(115)  评论(0编辑  收藏  举报