Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

将yd-cityselect组件改为无限层级,不再仅仅只支持3级 #766

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/components/cityselect/src/cityselect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</path>
</svg>
</div>
<ul v-show="ready" class="yd-cityselect-content" :class="activeClasses">
<ul v-show="ready" class="yd-cityselect-content" :class="activeClasses" :style="navIndex > 2 ? `transform: translate(-${navIndex * 50 - 100}%);` : '`transform: translate(0%)'" >
<li class="yd-cityselect-item" v-for="index, key in columnNum" :ref="'itemBox' + index" :key="key">
<template v-if="columnsObj['columnItems' + index] && columnsObj['columnItems' + index].length > 0">
<div class="yd-cityselect-item-box">
Expand Down Expand Up @@ -178,8 +178,8 @@
}

this.clearNavTxt(index);

if (index === this.columnNum || children.length <= 0) {
// 修复没有子级时children.length报错
if (index === this.columnNum || !children || children.length <= 0) {
if (index !== this.columnNum) {
for (let i = this.columnNum; i >= 0; i--) {
if (i > index) {
Expand Down Expand Up @@ -268,4 +268,10 @@

<style lang="less">
@import "../../../styles/components/cityselect.less";
.yd-cityselect-nav {
overflow-x: auto;
}
.yd-cityselect-nav > a {
flex-shrink: 0;
}
</style>