Dropbox 선택기을 내 ember 응용 프로그램에 통합하려고합니다. 이것은 dropbox에 의해 생성 된 스 니펫입니다.ember를 사용하여 Dropbox 선택기를 추가하십시오.
<script type="text/javascript" src="https://www.dropbox.com/static/api/1/dropins.js" id="dropboxjs" data-app-key="XXXXXXXXXXX"></script>
<input type="dropbox-chooser" name="selected-file" id="db-chooser"/>
<script type="text/javascript">
document.getElementById("db-chooser").addEventListener("DbxChooserSuccess",
function(e) {
alert("Here's the chosen file: " + e.files[0].link)
}, false);
</script>
이것은 엠버에서 구현 한 방법입니다.
응용 프로그램 레이아웃 파일에 <script type="text/javascript" src="https://www.dropbox.com/static/api/1/dropins.js" id="dropboxjs" data-app-key="XXXXXXXXXXX"></script>
이 포함됩니다.
window.App = Ember.Application.create({
rootElement: '#ember-app',
customEvents: {
DbxChooserSuccess: "DbxChooserSuccess"
},
)};
App.TestView = Em.View.extend({
templateName: "test_view",
tagName: "li",
testAction: function(e) {
alert("DbxChooserSuccess event triggered");
}
});
//test_view.js.hjs
<input type="dropbox-chooser" name="selected-file" id="db-chooser" {{action "testAction" on="DbxChooserSuccess" target="view"}}/>
이것은 작동하지 않습니다. 내 질문에 우리는 어떻게 사용자 정의 이벤트 리스너를 추가 할 수 있습니다 html 요소 ember에?
엠버가 아니라 내부에서 일어나는 사건을 알고있다. e body는 이벤트 위임을하기 위해 Ember가 연결되는 곳이기 때문에 Dropbox 스 니펫이 body 태그 안에 살고 있습니까? – intuitivepixel