0
我遵循使用组件加载视图的official documentation中描述的模式。其中一个组件有一个表单域,我需要调用一个名为.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
)
上我怎么可能初始化表单字段任何帮助将不胜感激。
谢谢