click.tigger()を使用して、テンプレートのモードを編集可能に変更しようとしています。問題は、このテンプレート内に画像のギャラリーがあり、click.triggerを起動したくないということです。click.trigger()が特定のネストされた要素で発生しないようにする
app.js:
<div click.trigger="enableEdit()">
<response containerless></response>
</div>
response.html:
<template>
<div>
...
<gallery></gallery> <-- I want this to still be able to fire
<button click.trigger="save()">save</button> <-- I want this to work as well but they wont with "enableEdit()" above attached.
</div>
</template>
Gallery.js:
attached() {
const carousel = new Flickity(this.gallery, {
cellAlign: 'left',
contain: true,
lazyLoad: true,
});
}
私はそれが動作し、トリガーをクリックし、編集を有効にすると。ギャラリーはFlickityというプラグインを使用しています。上記の私はそれをどのようにインスタンス化したかを示します。
その$ event.targetはjquery noですか?ターゲットを渡すか、ターゲットをつかむためのバニラのアプローチはありますか? – allencoded
'$ event'は、あなたが起動したDOMイベントへのアクセスを与える' delegate'と 'trigger'バインディングにバインドできるaureliaプロパティです。 –