Polymer 사용자 정의 요소에서 getElementById를 사용하려면 어떻게해야합니까?getElementById in Polymer 요소
여기 내 요소 :
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../styles/shared-styles.html">
<dom-module id="bb-calendar">
<template>
<style is="custom-style" include="shared-styles"></style>
<div class="card">
<paper-toolbar>
<div title>Calendar</div>
</paper-toolbar>
<div id="hideme">
<div>this should be hidden</div>
</div>
</div>
</template>
<script>
Polymer({
is: 'bb-calendar',
ready: function() {
document.getElementById("hideme").style.display = 'none';
}
});
</script>
</dom-module>
나는이 오류 메시지가 얻을 코드를 실행하면 :
Uncaught TypeError: Cannot read property 'style' of null
는 분명 내가 뭔가를 잘못하고 있어요 그러나 나는 무엇을 모르겠어요.
도움 주셔서 감사합니다! 마지막 답안에서했던 것과 같은 문제를 해결했습니다 (나를 위해 일한 다른 사람이 아닌). 1. 클래스 이름에서 "2. 클래스 이름에 고정"2. 속성 대신 'this.hiddenClass'를 사용했습니다. 감사합니다 . –
피드백을 보내 주셔서 감사 드리며 실수로 미안합니다. 나는 Dart 만 사용합니다. –
'ready.'핸들러는'this. $. hideme'이고'this. $$ ('# hideme')'. –