优化随机 key 生成方法
Former-commit-id: 2348f6645bc354fc5f5e2c1291c5d2cebf047348 [formerly 2348f6645bc354fc5f5e2c1291c5d2cebf047348 [formerly 2348f6645bc354fc5f5e2c1291c5d2cebf047348 [formerly 2348f6645bc354fc5f5e2c1291c5d2cebf047348 [formerly 6ae432905579811cde8979f29eee143da2706ca9 [formerly b335fc640794be976eaf84839c300e516cc56a0d]]]]] Former-commit-id: 7f8133308daa457b267e5a160df57530c69b92d7 Former-commit-id: 542ece96fc0188c1b72ead599382a9401d5a8035 Former-commit-id: 6c9fb38e18e09335d8369c19d657df742f1cac2c [formerly 1e2ccbec826a2f09cf17b40c3177b7b2b1ededbf] Former-commit-id: 672b25396325dc96564258784081f3d9fc2b3645 Former-commit-id: 6dea504c5f475fee69c9a7bde160173168bcc81f Former-commit-id: 63c30f7c3133c8ff0fce3b82c915c064412e0c46 Former-commit-id: f761a3e86ec11791a9199b5e095542aea4f310b6 Former-commit-id: 9ea8078a4da3547446a5b00d0939b3dd67d38215
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import day from 'dayjs'
|
||||
import { uniqueId } from 'lodash'
|
||||
import { mapActions } from 'vuex'
|
||||
export default {
|
||||
data () {
|
||||
@@ -113,12 +113,12 @@ export default {
|
||||
* 添加一个随机数据
|
||||
*/
|
||||
async handleSetRandom () {
|
||||
const id = day().valueOf()
|
||||
const id = uniqueId()
|
||||
const db = await this.databasePage({
|
||||
vm: this
|
||||
})
|
||||
db
|
||||
.set(id, Math.round(id * Math.random()))
|
||||
.set(`uniqueKey${id}`, `value${id}`)
|
||||
.write()
|
||||
this.load()
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import day from 'dayjs'
|
||||
import { uniqueId } from 'lodash'
|
||||
import { mapActions } from 'vuex'
|
||||
export default {
|
||||
data () {
|
||||
@@ -117,13 +117,13 @@ export default {
|
||||
* 添加一个随机数据
|
||||
*/
|
||||
async handleSetRandom () {
|
||||
const id = day().valueOf()
|
||||
const id = uniqueId()
|
||||
const db = await this.databasePage({
|
||||
vm: this,
|
||||
user: true
|
||||
})
|
||||
db
|
||||
.set(id, Math.round(id * Math.random()))
|
||||
.set(`uniqueKey${id}`, `value${id}`)
|
||||
.write()
|
||||
this.load()
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import day from 'dayjs'
|
||||
import { uniqueId } from 'lodash'
|
||||
import { mapActions } from 'vuex'
|
||||
export default {
|
||||
data () {
|
||||
@@ -105,10 +105,10 @@ export default {
|
||||
* 添加一个随机数据
|
||||
*/
|
||||
async handleSetRandom () {
|
||||
const id = day().valueOf()
|
||||
const id = uniqueId()
|
||||
const db = await this.database()
|
||||
db
|
||||
.set(id, Math.round(id * Math.random()))
|
||||
.set(`uniqueKey${id}`, `value${id}`)
|
||||
.write()
|
||||
this.load()
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import day from 'dayjs'
|
||||
import { uniqueId } from 'lodash'
|
||||
import { mapActions } from 'vuex'
|
||||
export default {
|
||||
data () {
|
||||
@@ -105,10 +105,10 @@ export default {
|
||||
* 添加一个随机数据
|
||||
*/
|
||||
async handleSetRandom () {
|
||||
const id = day().valueOf()
|
||||
const id = uniqueId()
|
||||
const db = await this.database({ user: true })
|
||||
db
|
||||
.set(id, Math.round(id * Math.random()))
|
||||
.set(`uniqueKey${id}`, `value${id}`)
|
||||
.write()
|
||||
this.load()
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ export default {
|
||||
return new Promise(resolve => {
|
||||
resolve(db.get(pathInit({
|
||||
dbName: 'database',
|
||||
path: vm.$route[basis],
|
||||
path: `$page.${vm.$route[basis]}`,
|
||||
user,
|
||||
defaultValue: {}
|
||||
})))
|
||||
@@ -141,7 +141,7 @@ export default {
|
||||
return new Promise(resolve => {
|
||||
resolve(db.get(pathInit({
|
||||
dbName: 'database',
|
||||
path: vm.$route[basis],
|
||||
path: `$page.${vm.$route[basis]}`,
|
||||
user,
|
||||
validator: () => false,
|
||||
defaultValue: {}
|
||||
@@ -163,7 +163,7 @@ export default {
|
||||
return new Promise(resolve => {
|
||||
resolve(db.get(pathInit({
|
||||
dbName: 'database',
|
||||
path: `${vm.$route[basis]}.$data`,
|
||||
path: `$page.${vm.$route[basis]}.$data`,
|
||||
user,
|
||||
validator: () => false,
|
||||
defaultValue: vm.$data
|
||||
@@ -185,7 +185,7 @@ export default {
|
||||
return new Promise(resolve => {
|
||||
resolve(db.get(pathInit({
|
||||
dbName: 'database',
|
||||
path: `${vm.$route[basis]}.$data`,
|
||||
path: `$page.${vm.$route[basis]}.$data`,
|
||||
user,
|
||||
defaultValue: vm.$data
|
||||
})).value())
|
||||
@@ -206,7 +206,7 @@ export default {
|
||||
return new Promise(resolve => {
|
||||
resolve(db.get(pathInit({
|
||||
dbName: 'database',
|
||||
path: `${vm.$route[basis]}.$data`,
|
||||
path: `$page.${vm.$route[basis]}.$data`,
|
||||
user,
|
||||
validator: () => false,
|
||||
defaultValue: {}
|
||||
|
||||
Reference in New Issue
Block a user