Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/460.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript “重复”属性无效_Javascript_Html_Dom_Polymer - Fatal编程技术网

Javascript “重复”属性无效

Javascript “重复”属性无效,javascript,html,dom,polymer,Javascript,Html,Dom,Polymer,我一直在遵循一个教程,并尝试为自己的基本联系人名单的事情。当不在dom重复模板中的不同部分出现时,它们在组件中显示得很好。使用polymer网站上的dom repeat后,它们不再出现 index.html <!doctype html> <html lang="en"> <head> Everything is linked correctly </head> <body> <aside> <

我一直在遵循一个教程,并尝试为自己的基本联系人名单的事情。当不在dom重复模板中的不同部分出现时,它们在组件中显示得很好。使用polymer网站上的dom repeat后,它们不再出现

index.html

<!doctype html>

<html lang="en">

<head>
  Everything is linked correctly
</head>

<body>
    <aside>
    <contact-list></contact-list>
    </aside>
</body>

</html> 

一切都连接正确
componenent.html

    <link rel="import" href="bower_components/polymer/polymer.html">

    <dom-module id="contact-list">

        <style>
            ul {
                list-style: none;
            }

            li {
                display: flex;
                padding: 20px;
            }

            li img {
                border-radius: 50%;
                margin-right: 10px;
            }

        li + li {
            border-top: solid 1px #666;
        }

        h3 {
            margin-right: 0 40px 0 0;
            line-height: 80px;
        }

        li span {
            line-height: 120px;
            margin-left: 20px;
        }
    </style>

    <template>
        <ul>
            <template is="dom-repeat" items="{{contact}}">
                <li>
                    <img src="{{item.img}}" alt="User Photo">
                    <h3>{{item.name}}</h3>
                    <span>{{item.email}}</span>
                </li>
            </template>
        </ul>
    </template>
</dom-module>

<script>
Polymer({
    is: "contact-list",
    ready: funtion() {
        this.contact = [
            {
                name: "Scott",
                email: "ShimyShimy@gmail.com",
                img: "https://randomuser.me/api/portraits/men/45.jpg"
    }

            , {
                name: "Tim",
                email: "DankMemer@gmail.com",
                img: "https://randomuser.me/api/portraits/men/28.jpg"
    }

            , {
                name: "Ben",
                email: "SuperCuck@gmail.com",
                img: "https://randomuser.me/api/portraits/men/68.jpg"
    }
        ]
    }

});
</script>

保险商实验室{
列表样式:无;
}
李{
显示器:flex;
填充:20px;
}
李英明{
边界半径:50%;
右边距:10px;
}
李+李{
边框顶部:实心1px#666;
}
h3{
右边距:0 40px 0 0;
线高:80px;
}
李斯潘{
线高:120px;
左边距:20px;
}
  • {{item.name} {{item.email}
聚合物({ 是:“联系人列表”, 准备好了:funtion(){ 此联系人=[ { 姓名:“斯科特”, 电子邮件:“ShimyShimy@gmail.com", img:“https://randomuser.me/api/portraits/men/45.jpg" } , { 姓名:“蒂姆”, 电子邮件:“DankMemer@gmail.com", img:“https://randomuser.me/api/portraits/men/28.jpg" } , { 姓名:“本”, 电子邮件:“SuperCuck@gmail.com", img:“https://randomuser.me/api/portraits/men/68.jpg" } ] } });
您在以下方面有输入错误:

ready: funtion() {
这应该是带有“c”的
函数
。修复这个问题就足以让你的代码为我工作(见下面的演示)


保险商实验室{
列表样式:无;
}
李{
显示器:flex;
填充:20px;
}
李英明{
边界半径:50%;
右边距:10px;
}
李+李{
边框顶部:实心1px#666;
}
h3{
右边距:0 40px 0 0;
线高:80px;
}
李斯潘{
线高:120px;
左边距:20px;
}
  • {{item.name} {{item.email}
HTMLImports.whenReady(函数(){ 聚合物({ 是:“联系人列表”, 就绪:函数(){ 此联系人=[{ 姓名:“斯科特”, 电子邮件:“ShimyShimy@gmail.com", img:“https://randomuser.me/api/portraits/men/45.jpg" }, { 姓名:“蒂姆”, 电子邮件:“DankMemer@gmail.com", img:“https://randomuser.me/api/portraits/men/28.jpg" }, { 姓名:“本”, 电子邮件:“SuperCuck@gmail.com", img:“https://randomuser.me/api/portraits/men/68.jpg" }]; } }); });
gahhh我太笨了,我总是做这样的事;kjfal;sjasl;djf;lasjfl;awejfwe;jfwefjwaefjwel;fwkl;