mirror of
https://github.com/lana-k/sqliteviz.git
synced 2025-12-06 18:18:53 +08:00
duplicate feature
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
<div class="date-container">{{ query.createdAt | date }}</div>
|
||||
<div class="icons-container">
|
||||
<rename-icon @click="showRenameDialog(index)" />
|
||||
<copy-icon />
|
||||
<copy-icon @click="duplicateQuery(index)"/>
|
||||
<export-icon />
|
||||
<delete-icon />
|
||||
</div>
|
||||
@@ -151,6 +151,14 @@ export default {
|
||||
this.$store.commit('updateTabName', { index: tabIndex, newName: this.newName })
|
||||
}
|
||||
},
|
||||
duplicateQuery (index) {
|
||||
const newQuery = JSON.parse(JSON.stringify(this.queries[index]))
|
||||
newQuery.name = newQuery.name + ' Copy'
|
||||
newQuery.id = Number(new Date())
|
||||
newQuery.createdAt = new Date()
|
||||
this.queries.push(newQuery)
|
||||
this.saveQueriesInLocalStorage()
|
||||
},
|
||||
saveQueriesInLocalStorage () {
|
||||
localStorage.setItem('myQueries', JSON.stringify(this.queries))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user