白色主题
This commit is contained in:
@@ -9,11 +9,6 @@ import config from '../common/config';
|
||||
import props from './props';
|
||||
const { prefix } = config;
|
||||
const name = `${prefix}-swiper`;
|
||||
const defaultNavigation = {
|
||||
type: 'dots',
|
||||
minShowNum: 2,
|
||||
showControls: false,
|
||||
};
|
||||
let Swiper = class Swiper extends SuperComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
@@ -29,58 +24,51 @@ let Swiper = class Swiper extends SuperComponent {
|
||||
};
|
||||
this.properties = props;
|
||||
this.observers = {
|
||||
current(v) {
|
||||
navCurrent(v) {
|
||||
this.updateNav(v);
|
||||
},
|
||||
navigation(val) {
|
||||
this.setData({
|
||||
_navigation: Object.assign(Object.assign({}, defaultNavigation), val),
|
||||
});
|
||||
},
|
||||
};
|
||||
this.$nav = null;
|
||||
this.relations = {
|
||||
'./swiper-nav': {
|
||||
'../swiper-nav/swiper-nav': {
|
||||
type: 'child',
|
||||
},
|
||||
};
|
||||
this.data = {
|
||||
_navigation: null,
|
||||
prefix,
|
||||
classPrefix: name,
|
||||
};
|
||||
this.lifetimes = {
|
||||
ready() {
|
||||
this.initNav();
|
||||
this.updateNav(this.data.current);
|
||||
const { current } = this.properties;
|
||||
this.setData({ navCurrent: current });
|
||||
},
|
||||
};
|
||||
this.methods = {
|
||||
initNav() {
|
||||
updateNav(currentValue) {
|
||||
var _a;
|
||||
const { _navigation } = this.data;
|
||||
if (_navigation) {
|
||||
this.$nav = this.selectComponent('#swiperNav');
|
||||
}
|
||||
else {
|
||||
this.$nav = (_a = this.getRelationNodes('./swiper-nav')) === null || _a === void 0 ? void 0 : _a[0];
|
||||
}
|
||||
},
|
||||
updateNav(index) {
|
||||
var _a;
|
||||
if (!this.$nav)
|
||||
if (this.data.navigation)
|
||||
return;
|
||||
const $nav = (_a = this.getRelationNodes('./swiper-nav')) === null || _a === void 0 ? void 0 : _a[0];
|
||||
if (!$nav)
|
||||
return;
|
||||
const { direction, paginationPosition, list } = this.properties;
|
||||
(_a = this.$nav) === null || _a === void 0 ? void 0 : _a.onChange({
|
||||
index,
|
||||
$nav.setData({
|
||||
current: currentValue,
|
||||
total: list.length,
|
||||
direction,
|
||||
paginationPosition,
|
||||
});
|
||||
},
|
||||
onTap(e) {
|
||||
const { index } = e.currentTarget.dataset;
|
||||
this.triggerEvent('click', { index });
|
||||
},
|
||||
onChange(e) {
|
||||
const { current, source } = e.detail;
|
||||
this.setData({ current });
|
||||
this.setData({
|
||||
navCurrent: current,
|
||||
});
|
||||
this.triggerEvent('change', { current, source });
|
||||
},
|
||||
onNavBtnChange(e) {
|
||||
|
||||
Reference in New Issue
Block a user