小编ste*_*fan的帖子

聚合物paper-button syntaxerror函数语句需要一个名称

我希望在单击按钮时触发该函数,但不知何故,它在控制台中给出了一个错误"syntaxerror:function statement require a name".我错过了什么?

<link href="assets/polymer/paper-button/paper-button.html" rel="import">

<polymer-element name="test-button" attributes="">
  <template>
    <style>
    paper-button[default] {
      color: #4285f4;
    }
    </style>
    <paper-button label="Accept" onclick="{{ saveButton }}" default></paper-button>


    <div id="label"><content></content></div>

  </template>
  <script>
    Polymer('test-button', {
      saveButton: function() {
        alert('button clicked');
      }
    });   


  </script>
</polymer-element>
Run Code Online (Sandbox Code Playgroud)

缩短我的问题:我遗漏了我的主文件的代码,我导入元素并显示它<test-button></test-button>.谢谢你的帮助.

javascript polymer

2
推荐指数
1
解决办法
1099
查看次数

标签 统计

javascript ×1

polymer ×1