liangjin
2021-04-01 006010711477c17f05de52f074a284e0184923b5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<script>
import {mapState} from 'vuex';
import Test from '@/components/Test';
export default {
    data() {
        return {
            com:'Test',
            isShow:false,
            arrs:[
                <Test a='aaa'></Test>,
                <Test a='bbb'></Test>
            ],
            dom:<h1 onClick={this.click}>点我 改变test dom</h1>
        }
    },
    computed:{
        ...mapState(["message"])
    },
    components:{
        Test
    },
    methods:{
        click(){
            this.dom = <h3>我变成了 h3~</h3>
        },
        test(){
            return new Promise((resolve,reject)=>{
                setTimeout(() => {
                    resolve('test');
                }, 2000);
            })
        },
        chengeArrs(){
            setTimeout(() => {
                this.isShow = true;
                this.arrs.reverse();
                console.log(11)
                // [].reverse()
            }, 500);
        }
    },
    created(){
        this.chengeArrs();
    },
    render(){
        if(this.isShow){
            return (
                <div>
                    {this.arrs}
                    {this.dom}
                    <h2 class="test1">{this.message}</h2>
                </div>
            )
        }else{
            return
        }
    }
}
</script>
 
<style lang="less" scoped>
.test1{
    color: @c-white;
    padding: 15px;
    background-color: @c-pink;
}
</style>