Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue2 can't work #2

Open
ScauZhang opened this issue Dec 16, 2016 · 4 comments
Open

vue2 can't work #2

ScauZhang opened this issue Dec 16, 2016 · 4 comments

Comments

@ScauZhang
Copy link

No description provided.

@Coffcer
Copy link
Owner

Coffcer commented Dec 21, 2016

2.0直接用组件形式吧

<lazy>
...
</lazy>

几行代码而已,可以自己实现一个~

@HeftyKoo
Copy link

@Coffcer 你好,我最近也遇到了渲染慢的问题,请问一下2.0的组件实现思路大概是怎样的呢?谢谢

@Coffcer
Copy link
Owner

Coffcer commented Dec 23, 2016

@yeyuqiudeng 类似这样

<script>
export default {
    props: {
        time: Number
    },
    data () {
        return {
            show: false
        };
    },
    created () {
        window.setTimeout(() => {
            this.show = true;
        }, this.time);
    }
}
</script>

<template>
<div v-if="show">
    <slot></slot>
</div>
</template>

@HeftyKoo
Copy link

嗯嗯,谢谢,已经做好了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants