以下のようなコードを書いているのですが、onMouseとoffMouseの関数がなぜか動きません。
そして、onmouuseoverを指定している要素にカーソルを持っていくと「Uncaught ReferenceError: onMouse is not defined」というエラーが発生します。(onmouseoutも同様)。
いろいろ試行錯誤しているのですが、どうもうまくいかないため、わかる方教えて下さい。
HTML
1<div class='bodyTextWrapper'> 2 <!--テキストエリアに入力したテキストを表示--> 3 <raw content="{'<div><' + body.tag + ' ' + 'class="' + body.class + '" onmouseover={onMouse} onmouseout={offMouse}>' + body.main + '</' + body.tag + '><div show={show}>delete</div></div>'}" name='content' each={ body, i in bodyMixin.bodyContents } /> 4 5 <!--テキストエリア--> 6 <div class='inputArea'> 7 <div> 8 <label> 9 <textarea name='text' placeholder='Input Text'></textarea> 10 <button onclick={ addText }>add</button> 11 </label> 12 </div> 13</div>
javascript
1this.mixin('bodyMixin') 2this.bodyMixin.bodyContents = [] 3 4addText(e) { 5 var bodyContent = { tag: 'p', class: 'text', main: this.text.value} 6 this.bodyMixin.bodyContents.push(bodyContent) 7 this.text.value = '' 8 this.update() 9 console.log(this.bodyMixin.bodyContents) 10} 11 12//「1」は表示されず、この関数は動いていない 13//this.on('update', function(){}で括ってもうまくいかず 14onMouse(e) { 15 this.show = true 16 console.log('1') 17} 18//「2」は表示されず、この関数は動いていない 19offMouse(e) { 20 this.show = false 21 console.log('2') 22}
ちなみにディベロッパーツールで確認すると、テキストエリアに入力されたテキストの表示部分は以下のようになっています。
<raw name="content" content="<div><p class="text" onmouseover={onMouse} onmouseout={offMouse}>adfa</p><div show={show}>delete</div></div>"><div><div show="{show}">delete</div><p class="text" onmouseover="{onMouse}" onmouseout="{offMouse}">入力内容</p></div></raw> <p class="text" onmouseover="{onMouse}" onmouseout="{offMouse}">入力内容</p> <div show="{show}">delete</div> </raw>
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2016/09/27 02:09
2016/09/27 02:27 編集
退会済みユーザー
2016/09/27 03:56