Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

:zap: Include the index in item ID

Alicia Sykes2f3b89bbb0b7
diff --git a/src/components/LinkItems/Section.vue b/src/components/LinkItems/Section.vue
index 9fbdb825..59e8523d 100644
--- a/src/components/LinkItems/Section.vue
+++ b/src/components/LinkItems/Section.vue
@@ -17,9 +17,9 @@
:style="gridStyle"
>
<Item
- v-for="(item) in sortedItems"
- :id="makeId(title, item.title)"
- :key="makeId(title, item.title)"
+ v-for="(item, index) in sortedItems"
+ :id="makeId(title, item.title, index)"
+ :key="makeId(title, item.title, index)"
:url="item.url"
:title="item.title"
:description="item.description"
@@ -114,9 +114,10 @@ export default {
},
methods: {
/* Returns a unique lowercase string, based on name, for section ID */
- makeId(sectionStr, itemStr) {
+ makeId(sectionStr, itemStr, index) {
const charSum = sectionStr.split('').map((a) => a.charCodeAt(0)).reduce((x, y) => x + y);
- return `${charSum}_${itemStr.replace(/\s+/g, '-').replace(/[^a-zA-Z ]/g, '').toLowerCase()}`;
+ const itemTitleStr = itemStr.replace(/\s+/g, '-').replace(/[^a-zA-Z ]/g, '').toLowerCase();
+ return `${index}_${charSum}_${itemTitleStr}`;
},
/* Opens the iframe modal */
triggerModal(url) {