我在Vue中有一些自定义组件.js.在其中一个组件中,我有一个 Select 列表,我想将其渲染为Chosen Select 框.我将其与jQuery函数$("select").chosen()
一起使用.
<template v-for="upload in uploads">
<new-upload-container :index="$index" :upload="upload" v-if="isNewUpload"></new-upload-container>
<existing-upload-container :index="$index" :upload="upload" v-if="isExistingUpload"></existing-upload-container>
</template>
将数据添加到Vue实例中的uploads
绑定数组后,视图将使用组件的实例进行更新.不幸的是,当我试图在select字段上实例化Chosen
时,它不起作用.
我不确定在向DOM实际更新的uploads
绑定数组中添加一个项之后是否需要很短的时间.
<template id="existing-upload-container">
<select name="beats[@{{ index }}][existing_beat]" class="existing-beats">
<option selected="selected" value="">-- Select a linked beat --</option>
@foreach ($beats as $beat)
<option value="{{$beat->id}}">{{$beat->name}}</option>
@endforeach
</select>
</template>
组件完全渲染后是否会触发事件?