mirror of
https://github.com/Lissy93/dashy.git
synced 2025-07-23 21:55:30 +02:00
⚡ Include the index in item ID
This commit is contained in:
parent
7f555ee142
commit
2f3b89bbb0
@ -17,9 +17,9 @@
|
|||||||
:style="gridStyle"
|
:style="gridStyle"
|
||||||
>
|
>
|
||||||
<Item
|
<Item
|
||||||
v-for="(item) in sortedItems"
|
v-for="(item, index) in sortedItems"
|
||||||
:id="makeId(title, item.title)"
|
:id="makeId(title, item.title, index)"
|
||||||
:key="makeId(title, item.title)"
|
:key="makeId(title, item.title, index)"
|
||||||
:url="item.url"
|
:url="item.url"
|
||||||
:title="item.title"
|
:title="item.title"
|
||||||
:description="item.description"
|
:description="item.description"
|
||||||
@ -114,9 +114,10 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/* Returns a unique lowercase string, based on name, for section ID */
|
/* 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);
|
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 */
|
/* Opens the iframe modal */
|
||||||
triggerModal(url) {
|
triggerModal(url) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user