コンポーネントを使用してビューをロードする公式ドキュメントに記載されているパターンに従っています。コンポーネントの 1 つにフォーム フィールドがあり.tagsinput()
、私はTagsInputを使用しているため、メソッドを呼び出す必要があります。のようなもの$('#tags').tagsinput()
です。これが私がやっていることの簡略化されたバージョンです:
CreateBoardForm = Vue.extend
template: "<input type='text' v-text='tags' id='tags'/>"
data:
tags: ''
ready: ->
// this is where I'm hoping to access
// tags and call $('#tags').tagsinput() on it
// However, this.$el and this.template are all undefined
// I was hoping to do something like this.$el.find('#tags').tagsinput()
Vue.component('CreateBoardForm', CreateBoardForm)
vue = new Vue(
el: '#main',
data:
currentView: 'createBoardForm'
components:
createBoardForm: CreateBoardForm
)
そのフォームフィールドを初期化する方法についての助けをいただければ幸いです。
ありがとうございました