Поддержка одиночного элемента
This commit is contained in:
		
							
								
								
									
										8
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								index.js
									
									
									
									
									
								
							@@ -310,6 +310,13 @@ const init = async (items = [], options = {}, index = 0) => {
 | 
			
		||||
 | 
			
		||||
export default (container, options) => {
 | 
			
		||||
    const items = [];
 | 
			
		||||
    if (options.single) {
 | 
			
		||||
        items.push(container.href);
 | 
			
		||||
        container.addEventListener('click', (event) => {
 | 
			
		||||
            event.preventDefault();
 | 
			
		||||
            init(items, options);
 | 
			
		||||
        });
 | 
			
		||||
    } else {
 | 
			
		||||
        for (const [index, element] of [...container.children].entries()) {
 | 
			
		||||
            items.push(element.href);
 | 
			
		||||
            element.addEventListener('click', (event) => {
 | 
			
		||||
@@ -317,4 +324,5 @@ export default (container, options) => {
 | 
			
		||||
                init(items, options, index);
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user