$( '。selectpicker')を書くと、selectpicker( 'refresh');コンソールにロードされています。このコードはどこで提供しますか?vue jsを使用してJSONデータを表示しようとすると、Selectpickerが機能しません。
私のHTMLコードは下記のよう
<form action="" class="form-inline" onsubmit="return false;" method="post" id="categories">
<div class="row">
<div class="col-xs-6">
<select id="lunchBegins" class="selectpicker" data-live-search="true" data-live-search-style="begins" title="Select Your City" v-model="category" name="category">
<option v-for="post in articles" v-bind:value="post.name">{{post.name}}</option>
</select>
</div>
<div class="col-xs-6">
<select id="basic" class="selectpicker show-tick form-control" v-model="subcategory" name="subcategory">
<option v-for="so in services" v-bind:value="so.name">{{so.name}}</option>
</select>
</div>
</div>
</form>
マイVUE jsのスクリプトがある..です私は(マウントでスクリプトを追加している)が、何も私のために起こりません。私は、コンソールで入力するときには...リストは
<script>
categories = new Vue({
el: '#categories',
data: {
articles: [],
services: [],
category: 0,
subcategory: 0,
content: false
},
watch: {
subcategory: function(e) {
this.prefetch();
},
category: function() {
var self = this;
self.subcategory = 0;
$.ajax({
url: "https://n2s.herokuapp.com/api/post/get_all_services/",
data: {
'service': self.id
},
type: "POST",
dataType: "JSON",
success: function(e) {
console.log('Loading services');
console.log(self.category);
let categoryIdArray = self.articles.filter(x=>x.name==self.category);
console.log(categoryIdArray);
self.services = e.filter(x=>x.cat_id==categoryIdArray[0].cat_id);
console.log(self.services);
self.prefetch();
}
});
},
},
mounted: function() {
$('.selectpicker').selectpicker('refresh');
var vm = this;
$.ajax({
url: "https://n2s.herokuapp.com/api/post/get_all_category/",
method: "GET",
dataType: "JSON",
success: function(e) {
console.log(e);
vm.articles = e;
console.log(vm);
},
});
},
})
</script>
を表示されますドロップダウン選択ピッカーを初期化する方法はありますか?私を助けてください。
コメントは議論の対象外です。この会話は[チャットに移動]されています(http://chat.stackoverflow.com/rooms/160000/discussion-on-question-by-med-selectpicker-is-not-working-when-i-try-to-表示)。 – Andy