0
点赞
收藏
分享

微信扫一扫

VUE框架ES6的拓展运算符------VUE框架

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script type="text/javascript">
        let arr = [1,2,3,4,5,6,7,8,9,10];
        console.log(...arr);
        let o1 = {
            x : 1,
            y : 2
        };
        // 这个是语法错误
        // console.log(...o1);
 
        // 这个会生成一个新的对象
        console.log({...o1});
 
        // 主要用于对象的属性合并
        let o3 = {
            x : 1,
            y : 1
        };
        let o4 = {
            k : 1,
            f : 1
        };
        let o5 = {
            e : 1,
            w : 1
        };
 
        let o6 = {
            z : 1,
            b : 1
        };
 
        let o7 = {
            i : 1,
            p : 1
        };
 
        let o8 = {...o3,...o4,...o5,...o6,...o7};
        console.log(o8);
    </script>
</body>
</html>

举报

相关推荐

0 条评论