正在显示
2 个修改的文件
包含
7 行增加
和
4 行删除
| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 2 | <html> | 2 | <html> |
| 3 | <head> | 3 | <head> |
| 4 | <meta charset="utf-8"> | 4 | <meta charset="utf-8"> |
| 5 | - <title>my-project</title> | 5 | + <title>electron-vue-template</title> |
| 6 | <% if (htmlWebpackPlugin.options.nodeModules) { %> | 6 | <% if (htmlWebpackPlugin.options.nodeModules) { %> |
| 7 | <!-- Add `node_modules/` to global paths so `require` works properly in development --> | 7 | <!-- Add `node_modules/` to global paths so `require` works properly in development --> |
| 8 | <script> | 8 | <script> | ... | ... |
| ... | @@ -5,10 +5,10 @@ | ... | @@ -5,10 +5,10 @@ |
| 5 | <div class="left-side"> | 5 | <div class="left-side"> |
| 6 | <span class="title">Welcome to your new project!</span> | 6 | <span class="title">Welcome to your new project!</span> |
| 7 | <system-information></system-information> | 7 | <system-information></system-information> |
| 8 | - <div> | 8 | + <div v-if="textarray.length === 0"> |
| 9 | <span>{{text}}</span> | 9 | <span>{{text}}</span> |
| 10 | </div> | 10 | </div> |
| 11 | - <div v-for="(itme,index) in textarray" :key="index"> | 11 | + <div v-for="(itme,index) in textarray" :key="index" v-else> |
| 12 | <span>{{itme._id}}</span> | 12 | <span>{{itme._id}}</span> |
| 13 | <span>{{itme.name}}</span> | 13 | <span>{{itme.name}}</span> |
| 14 | <span>{{itme.age}}</span> | 14 | <span>{{itme.age}}</span> |
| ... | @@ -44,6 +44,7 @@ export default { | ... | @@ -44,6 +44,7 @@ export default { |
| 44 | }), | 44 | }), |
| 45 | methods: { | 45 | methods: { |
| 46 | open(link) { | 46 | open(link) { |
| 47 | + this.textarray.length | ||
| 47 | console.log(this.$electron); | 48 | console.log(this.$electron); |
| 48 | }, | 49 | }, |
| 49 | setdata() { | 50 | setdata() { |
| ... | @@ -63,13 +64,15 @@ export default { | ... | @@ -63,13 +64,15 @@ export default { |
| 63 | .catch(err => console.log(err)); | 64 | .catch(err => console.log(err)); |
| 64 | }, | 65 | }, |
| 65 | deledata(){ | 66 | deledata(){ |
| 67 | + // dialog为electron实例,data则是显示需要的参数,fun是需要执行的函数,此选项不是为必选的 | ||
| 66 | const dialog = this.$electron.remote.dialog | 68 | const dialog = this.$electron.remote.dialog |
| 67 | const data = { | 69 | const data = { |
| 68 | title:'清除数据', | 70 | title:'清除数据', |
| 69 | buttons:['OK', 'Cancel'], | 71 | buttons:['OK', 'Cancel'], |
| 70 | message:'此操作会清空本地数据库中的所有数据,是否继续?' | 72 | message:'此操作会清空本地数据库中的所有数据,是否继续?' |
| 71 | } | 73 | } |
| 72 | - api.MessageBox(dialog,data,this.$db.deleall({name:'yyy'})).then(res=>{ | 74 | + const fun = this.$db.deleall({name:'yyy'}) |
| 75 | + api.MessageBox(dialog,data,fun).then(res=>{ | ||
| 73 | console.log(res) | 76 | console.log(res) |
| 74 | }) | 77 | }) |
| 75 | }, | 78 | }, | ... | ... |
-
请 注册 或 登录 后发表评论