当前位置 : 主页 > 网页制作 > html >

vue 异步渲染

来源:互联网 收集:自由互联 发布时间:2021-06-12
! DOCTYPE html html head title hello world vue / title meta charset ="utf-8" / / head body div id ="app" v-cloak !-- 缺省挂载 currentView 变量指定的组件 -- my-home / my-home / div / body / html script src ="jquery-3.1.1.js" / scr
<!DOCTYPE html>
<html>

<head>
    <title> hello world vue </title>
    <meta charset="utf-8" />
</head>

<body>
    <div id="app" v-cloak>
        <!-- 缺省挂载 currentView 变量指定的组件 -->
        <my-home></my-home>

    </div>
</body>

</html>

<script src="jquery-3.1.1.js"></script>
<script src="vue.js"></script>


<script>
    $(document).ready(function() {

    });
</script>


<script>
    Vue.component(my-home, function(resolve, reject) {
        window.setTimeout(function() {
            resolve({
                template: <div>我是异步渲染的</div>
            });
        }, 2000);
    });

    var app = new Vue({
        el: #app,
        data: {},
        computed: {},
        methods: {},
        components: {},
        mounted: function() {}
    });
</script>
网友评论