切换导航条
切换导航条
当前项目
正在载入...
登录
术习电报
/
electron-vue-template
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
作者
umbrella22
2019-03-27 14:48:12 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
提交
2b52f30d943c8f68ea9905e31e99f4a6cc6c2dab
2b52f30d
1 个父辈
9d537848
添加原生弹窗
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
40 行增加
和
6 行删除
package.json
src/renderer/components/LandingPage.vue
src/renderer/tools/dialog.js
package.json
查看文件 @
2b52f30
{
"name"
:
"my-project"
,
"version"
:
"0.0.1"
,
"author"
:
"
fengjie <fengjie1438@f-road.com.cn
>"
,
"author"
:
"
sky <https://github.com/umbrella22
>"
,
"description"
:
"An electron-vue project"
,
"license"
:
null
,
"main"
:
"./dist/electron/main.js"
,
...
...
src/renderer/components/LandingPage.vue
查看文件 @
2b52f30
...
...
@@ -30,7 +30,7 @@
<script>
import SystemInformation from "./LandingPage/SystemInformation";
import api from '../tools/dialog'
export default {
name: "landing-page",
components: { SystemInformation },
...
...
@@ -63,13 +63,16 @@ export default {
.catch(err => console.log(err));
},
deledata(){
let data={
name:"yyy"
const dialog = this.$electron.remote.dialog
const data = {
title:'清除数据',
buttons:['OK', 'Cancel'],
message:'此操作会清空本地数据库中的所有数据,是否继续?'
}
this.$db.deleall(data
).then(res=>{
api.MessageBox(dialog,data,this.$db.deleall({name:'yyy'})
).then(res=>{
console.log(res)
})
}
}
,
}
};
</script>
...
...
src/renderer/tools/dialog.js
0 → 100644
查看文件 @
2b52f30
export
default
{
/**
* @export
* @param {Array} data
* @param {Object} dialog
* @param {function} fun
* @returns
* @feature 消息弹窗通用函数
*/
MessageBox
(
dialog
,
data
,
fun
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
dialog
.
showMessageBox
({
type
:
'info'
,
title
:
data
.
title
,
buttons
:
data
.
buttons
,
message
:
data
.
message
},
index
=>
{
if
(
index
===
0
)
{
let
tempfun
=
async
()
=>
{
try
{
resolve
(
await
fun
)
}
catch
(
error
)
{
reject
(
error
)
}
}
tempfun
()
}
})
})
}
}
\ No newline at end of file
请
注册
或
登录
后发表评论