feat: Add comprehensive documentation suite and reorganize project structure
- Created complete documentation in docs/ directory - Added PROJECT_OVERVIEW.md with feature highlights and getting started guide - Added ARCHITECTURE.md with system design and technical details - Added SECURITY.md with comprehensive security implementation guide - Added DEVELOPMENT.md with development workflows and best practices - Added DEPLOYMENT.md with production deployment instructions - Added API.md with complete REST API documentation - Added CONTRIBUTING.md with contribution guidelines - Added CHANGELOG.md with version history and migration notes - Reorganized all documentation files into docs/ directory for better organization - Updated README.md with proper documentation links and quick navigation - Enhanced project structure with professional documentation standards
This commit is contained in:
41
f_scripts/shared/swiper/vue/virtual.js
Normal file
41
f_scripts/shared/swiper/vue/virtual.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import { h } from 'vue';
|
||||
function renderVirtual(swiperRef, slides, virtualData) {
|
||||
if (!virtualData) return null;
|
||||
const getSlideIndex = index => {
|
||||
let slideIndex = index;
|
||||
if (index < 0) {
|
||||
slideIndex = slides.length + index;
|
||||
} else if (slideIndex >= slides.length) {
|
||||
// eslint-disable-next-line
|
||||
slideIndex = slideIndex - slides.length;
|
||||
}
|
||||
return slideIndex;
|
||||
};
|
||||
const style = swiperRef.value.isHorizontal() ? {
|
||||
[swiperRef.value.rtlTranslate ? 'right' : 'left']: `${virtualData.offset}px`
|
||||
} : {
|
||||
top: `${virtualData.offset}px`
|
||||
};
|
||||
const {
|
||||
from,
|
||||
to
|
||||
} = virtualData;
|
||||
const loopFrom = swiperRef.value.params.loop ? -slides.length : 0;
|
||||
const loopTo = swiperRef.value.params.loop ? slides.length * 2 : slides.length;
|
||||
const slidesToRender = [];
|
||||
for (let i = loopFrom; i < loopTo; i += 1) {
|
||||
if (i >= from && i <= to) {
|
||||
slidesToRender.push(slides[getSlideIndex(i)]);
|
||||
}
|
||||
}
|
||||
return slidesToRender.map(slide => {
|
||||
if (!slide.props) slide.props = {};
|
||||
if (!slide.props.style) slide.props.style = {};
|
||||
slide.props.swiperRef = swiperRef;
|
||||
slide.props.style = style;
|
||||
return h(slide.type, {
|
||||
...slide.props
|
||||
}, slide.children);
|
||||
});
|
||||
}
|
||||
export { renderVirtual };
|
||||
Reference in New Issue
Block a user