正在显示
3 个修改的文件
包含
15 行增加
和
6 行删除
| ... | @@ -43,16 +43,18 @@ export default { | ... | @@ -43,16 +43,18 @@ export default { |
| 43 | textarray: [] | 43 | textarray: [] |
| 44 | }), | 44 | }), |
| 45 | methods: { | 45 | methods: { |
| 46 | - open(link) { | 46 | + // 获取electron方法 |
| 47 | - this.textarray.length | 47 | + open() { |
| 48 | console.log(this.$electron); | 48 | console.log(this.$electron); |
| 49 | }, | 49 | }, |
| 50 | + // 设置数据库的数据 | ||
| 50 | setdata() { | 51 | setdata() { |
| 51 | this.$db | 52 | this.$db |
| 52 | .adddata(this.newdata) | 53 | .adddata(this.newdata) |
| 53 | - .then(res => console.log(res)) | 54 | + .then(res => this.getdata()) |
| 54 | .catch(err => console.log(err)); | 55 | .catch(err => console.log(err)); |
| 55 | }, | 56 | }, |
| 57 | + // 获取数据库的数据 | ||
| 56 | getdata() { | 58 | getdata() { |
| 57 | this.$db | 59 | this.$db |
| 58 | .finddata() | 60 | .finddata() |
| ... | @@ -63,6 +65,7 @@ export default { | ... | @@ -63,6 +65,7 @@ export default { |
| 63 | }) | 65 | }) |
| 64 | .catch(err => console.log(err)); | 66 | .catch(err => console.log(err)); |
| 65 | }, | 67 | }, |
| 68 | + // 清空数据库的数据 | ||
| 66 | deledata(){ | 69 | deledata(){ |
| 67 | // dialog为electron实例,data则是显示需要的参数,fun是需要执行的函数,此选项不是为必选的 | 70 | // dialog为electron实例,data则是显示需要的参数,fun是需要执行的函数,此选项不是为必选的 |
| 68 | const dialog = this.$electron.remote.dialog | 71 | const dialog = this.$electron.remote.dialog |
| ... | @@ -73,7 +76,12 @@ export default { | ... | @@ -73,7 +76,12 @@ export default { |
| 73 | } | 76 | } |
| 74 | const fun = this.$db.deleall({name:'yyy'}) | 77 | const fun = this.$db.deleall({name:'yyy'}) |
| 75 | api.MessageBox(dialog,data,fun).then(res=>{ | 78 | api.MessageBox(dialog,data,fun).then(res=>{ |
| 76 | - console.log(res) | 79 | + this.getdata() |
| 80 | + this.$message({ | ||
| 81 | + showClose: true, | ||
| 82 | + message: '成功删除'+res+'条', | ||
| 83 | + type: 'success' | ||
| 84 | + }); | ||
| 77 | }) | 85 | }) |
| 78 | }, | 86 | }, |
| 79 | } | 87 | } | ... | ... |
-
请 注册 或 登录 后发表评论