Skip to content

Commit

Permalink
优化组件属性面板示例
Browse files Browse the repository at this point in the history
  • Loading branch information
xilanhuaweidapao committed Nov 13, 2024
1 parent b7168c7 commit b27cec7
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions examples/component/components_attribute_panel_vue.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<sm-web-map server-url="https://iportal.supermap.io/iportal" map-id="801571284" @load="mapLoad">
</sm-web-map>
<div class="panel-wrapper">
<sm-attribute-panel :attributes="attrbiutes" :columns="tableColumns" :title="panelTitle">
<sm-attribute-panel :attributes="attrbiutes" :value-render="customValueRender" :title="panelTitle">
</sm-attribute-panel>
</div>
</div>
Expand All @@ -65,15 +65,6 @@
computed: {
panelTitle() {
return this.title || resources.text_attributePanel
},
tableColumns() {
return [{
dataIndex: 'attribute'
},
{
dataIndex: 'attributeValue'
}
];
}
},
methods: {
Expand All @@ -91,10 +82,11 @@
vm.title = matchFature.layer.id;
vm.attrbiutes = Object.keys(matchFature.properties).map(function (prop) {
return {
attribute: prop,
attributeValue: matchFature.properties[prop]
title: prop,
value: matchFature.properties[prop]
}
});
vm.attrbiutes = vm.attrbiutes.slice(4);
vm.addHighlightLayer(matchFature);
} else {
vm.attrbiutes = [];
Expand Down Expand Up @@ -133,6 +125,12 @@
if (this.map.getLayer('highlight')) {
this.map.removeLayer('highlight');
}
},
customValueRender(text, record, index) {
if (index === 3) {
return '第 ' + record.value + ' 名';
}
return record.value;
}
}
});
Expand Down

0 comments on commit b27cec7

Please sign in to comment.