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M,GAAG,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAC3C,WAAW;QACX,IAAI,CAAC,YAAY,CAAC,cAAc,kCAAO,GAAG,KAAE,GAAG,IAAG,CAAC;QACnD,eAAe;QACf,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,MAAA,IAAI,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;YACtB,MAAA,IAAI,CAAC,OAAO,0CAAG,GAAG,EAAE,GAAG,CAAC,CAAC;SAC1B;IACH,CAAC;CACF,CAAA;AA1DoB,SAAS;IAD7B,WAAW,EAAE;GACO,SAAS,CA0D7B;eA1DoB,SAAS","file":"swiper-nav.js","sourcesContent":["/**\n * 轮播导航器\n * 同时支持两种方式\n * 1、swiper简易配置,参见swiper的navigation。提升易用性\n * 2、自定义组件插槽组合,slot=nav。提升灵活性,方便样式覆盖\n */\nimport { SuperComponent, wxComponent } from '../common/src/index';\nimport config from '../common/config';\nimport { DIRECTION, NavTypes } from './common/constants';\n\nconst { prefix } = config;\ntype NavOptions = {\n index: number;\n total: number;\n direction: boolean;\n};\n\n@wxComponent()\nexport default class SwiperNav extends SuperComponent {\n externalClasses = [`${prefix}-class`];\n\n properties = {\n // 页码导航类型\n type: {\n type: String,\n value: NavTypes.dots,\n },\n // 最小显示数量,即小于这个数不会显示导航器\n minShowNum: {\n type: Number,\n value: 2,\n },\n /**\n * 是否开启导航按钮\n */\n hasNavBtn: {\n type: Boolean,\n value: false,\n },\n };\n\n relations = {\n './swiper': {\n type: 'parent' as 'parent',\n },\n };\n\n data = {\n index: 0,\n total: 0,\n direction: DIRECTION.HOR,\n prefix,\n classPrefix: `.${prefix}-swiper-nav`,\n };\n\n ready() {\n this.$swiper = this.getRelationNodes('./swiper')?.[0];\n }\n\n onChange(opt: NavOptions) {\n this.setData({\n ...opt,\n });\n }\n\n nav(e) {\n const { dir } = e.target.dataset;\n const opt = { source: 'nav', cycle: true };\n // 触发导航按钮事件\n this.triggerEvent('navBtnChange', { ...opt, dir });\n // 插槽嵌入时主动调用API\n if (this.$swiper) {\n this.$swiper?.pause();\n this.$swiper?.[dir](opt);\n }\n }\n}\n"]}
|