Skip to content

Commit

Permalink
fix: 修正L7Plot官网图表示例按钮跳转链接 (#2233)
Browse files Browse the repository at this point in the history
* fix: 修复配置更新时,处理单选模式图层问题

* feat: 修改函数名

* fix: 修正L7Plot官网图表示例按钮跳转链接

---------

Co-authored-by: 谨欣 <echo.cmy@antgroup.com>
  • Loading branch information
Dreammy23 and 谨欣 authored Jan 2, 2024
1 parent 34d7721 commit 9b03c2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/component/src/control/layerSwitch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default class LayerSwitch extends SelectControl<ILayerSwitchOption> {
super.setOptions(option);
if (isLayerChange) {
if (this.controlOption.multiple === false) {
this.handleSingleSelectionMode();
this.handleSingleSelection();
}
this.selectValue = this.getLayerVisible();
this.controlOption.options = this.getLayerOptions();
Expand All @@ -119,15 +119,15 @@ export default class LayerSwitch extends SelectControl<ILayerSwitchOption> {

// TODO: 单选模式下,目前默认展示第一项,通过用户提供defaultValue展示默认选项的属性待开发
// 如果是单选模式,则只显示第一个图层
private handleSingleSelectionMode() {
private handleSingleSelection() {
this.layers.forEach((layer, index) => {
index === 0 ? layer.show() : layer.hide();
});
}

public onAdd(): HTMLElement {
if (this.controlOption.multiple === false) {
this.handleSingleSelectionMode()
this.handleSingleSelection()
}

if (!this.controlOption.options?.length) {
Expand Down
2 changes: 1 addition & 1 deletion packages/site/site/pages/index.zh.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const IndexPage = () => {
const bannerButtons = [
{
text: t('图表示例'),
link: `/${i18n.language}/examples/gallery`,
link: `/${i18n.language}/examples`,
type: 'primary',
},
{
Expand Down

0 comments on commit 9b03c2e

Please sign in to comment.