Using Swiper in Subnavbar doesn’t work on ios any idea why?
Потому, что navbar в ios поднимается на уровень выше, он уходит из page.
so how can i make it work in ios?
Нужно создавать компонент вручную.
Remove swiper-init
class from it, and init manually using app.swiper.create
API
I did so but I encountered another problem, the swiper deosn’t really work it deosn’t scroll and just bounces back
This is my code:
<div class="subnavbar no-shadow">
<div class="subnavbar-inner">
<div class="swiper-container filter-swiper" key="filter-swiper">
<div class="swiper-wrapper">
<div class="swiper-slide">
<a class="smart-select smart-select-init filter-select" data-open-in="popover" @change="updateFilter">
<select name="interest" multiple>
{{#filterOptions}}
<option value="{{@index}}">{{title}}</option>
{{/filterOptions}}
</select>
<div class="chip chip-outline ripple md">
<div class="chip-label">Interessen</div>
</div>
</a>
</div>
{{#filter}}
<div class="swiper-slide" key="{{@index}}">
<div class="chip md">
<div class="chip-label">{{title}}</div>
<a href="#" class="chip-delete" @click="removeFilter({{@index}})"></a>
</div>
</div>
{{/filter}}
</div>
</div>
</div>
</div>
update Filter Method:
updateFilter: function (e) {
var self = this;
var app = self.$app;
var filterSelect = app.smartSelect.get('.filter-select');
filterSelect.on('close', function () {
self.filterSwiper.update();
})
//console.log(filterSelect.getValue());
self.filter = [];
filterSelect.getValue().forEach(function(element) {
self.filter.push(self.filterOptions[element])
})
self.$update();
},
Swiper Init:
self.filterSwiper = app.swiper.create(self.$('.filter-swiper'), {
slidesPerView: "auto",
spaceBetween: "10",
centeredSlides: true,
});
The problem I am having is, that the swiper doesn’t work it swipes just one slide and all other slides it bounces back
This means you init Swiper when it was hidden (maybe it is in some modal). You need to init it when it is visible, and/or call its .update()
method when it becomes visible. Or just try to its enable observer
and observeParents
parameters
no matter what i do it doesn’t work
here the example with code
{{#filter}}
<div class="swiper-slide" key="{{@index}}">
<div class="chip md">
<div class="chip-label">{{title}}</div>
<a href="#" class="chip-delete"></a>
</div>
</div>
{{/filter}}
{{#filter}} => {{#filterOptions}}
{{/filter}} => {{/filterOptions}}
filterOptions can be selected by clicking on filterSelect they are not supposed to be here always
and even doing your changes, the swiper still doesn’t work
Ok, you have
spaceBetween: '10',
but it must be a number:
spaceBetween: 10,
lol simple as that
any idea on how i could manage which is selected in the smart select?