Skip to content

Commit

Permalink
refactor: message default options
Browse files Browse the repository at this point in the history
  • Loading branch information
Raistlin916 committed Feb 17, 2019
1 parent 14ff0c4 commit 11b6d65
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 130 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
82 changes: 60 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions src/renderer/components/Msg/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export default {
install: function (Vue, Message, defaultOption = {}) {
Vue.prototype.$msg = new Proxy(Message, {
get (obj, prop) {
return (arg) => {
if (arg instanceof String) {
arg = { message: arg }
}
obj[prop]({
...defaultOption,
...arg
})
}
}
})
}
}
Loading

0 comments on commit 11b6d65

Please sign in to comment.