Vue create project:
vue init webpack-simple nedbtest
install Nedb database:
npm i nedb -S
change App.vue :
<template>
<div>
<button @click="insert">insertData</button>
<button @click="find">FindData</button>
</div>
</template>
<script>
var Datastore = require('nedb')
var db = new Datastore({filename:'./test.db', autoload:true})
export default {
name: 'app',
methods:{
insert () {
db.insert({name:"admin", password:"123"}, function(err, res) {
console.log(res)
})
},
find () {
db.find({}, function(err, res) {
console.log(res)
})
},
}
}
</script>
Where is the test.db file? I can not find this file! I can find this file when use Nodejs.