// 路径导航模块(复制自 client/js/disk/path.js) class ResourceManagerPathNavigator { constructor(options = {}) { this.container = options.container; this.rootName = options.rootName || '全部文件'; this.onNavigate = options.onNavigate || (() => {}); this.currentPath = ''; this.pathParts = []; this.init(); } init() { this.render(); this.bindEvents(); } bindEvents() { this.container.addEventListener('click', (e) => { const item = e.target.closest('.breadcrumb-item'); if (!item) return; const path = item.dataset.path || ''; this.navigateTo(path); }); } navigateTo(path) { this.currentPath = path; this.pathParts = path ? path.split('/').filter(p => p) : []; this.render(); this.onNavigate(path); } getPath() { return this.currentPath; } render() { let html = `${this.rootName}`; let currentPath = ''; this.pathParts.forEach((part, index) => { currentPath += (index === 0 ? '' : '/') + part; const isLast = index === this.pathParts.length - 1; html += `${part}`; }); this.container.innerHTML = html; } }