-
Notifications
You must be signed in to change notification settings - Fork 523
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
john
committed
Apr 22, 2020
1 parent
37eb1ff
commit ebae190
Showing
16 changed files
with
2,443 additions
and
2,777 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Vue from 'vue' | ||
import Toast from './index.vue' | ||
|
||
const ToastMsg = Vue.extend(Toast) | ||
|
||
Toast.install = (options, type) => { | ||
if (options === undefined || options === null) { | ||
options = { | ||
content: '' | ||
} | ||
} else if (typeof options === 'string' || typeof options === 'number') { | ||
options = { | ||
content: options | ||
} | ||
if (type !== undefined && options !== null) { | ||
options.type = type | ||
} | ||
} | ||
|
||
let instance = new ToastMsg({ | ||
data: options | ||
}).$mount() | ||
|
||
document.body.appendChild(instance.$el) | ||
|
||
Vue.nextTick(() => { | ||
instance.visible = true | ||
}) | ||
} | ||
|
||
export default Toast.install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<template> | ||
<transition name="fade"> | ||
<div class="toast-container" v-if="visible"> | ||
<div class="toast" :class="type"> | ||
<div class="content"> | ||
<i class="iconfont" :class="'icon-' + type"></i> | ||
<span>{{ content }}</span> | ||
</div> | ||
<!-- <i v-if="hasClose" class="iconfont icon-close close" @click="visible = false"></i> --> | ||
</div> | ||
</div> | ||
</transition> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'Toast', | ||
data() { | ||
return { | ||
content: '', | ||
time: 3000, | ||
visible: false, | ||
type: 'error', //四种类型:info, success, warning, error | ||
hasClose: true, | ||
} | ||
}, | ||
mounted() { | ||
this.close(); | ||
}, | ||
methods: { | ||
close () { | ||
setTimeout(() =>{ | ||
this.visible = false; | ||
}, this.time); | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
/* 动画效果 淡入淡出 */ | ||
.fade-enter-active, .fade-leave-active{ | ||
transition: all 0.5s ease; | ||
} | ||
.fade-enter, .fade-leave-active{ | ||
opacity: 0; | ||
} | ||
.toast-container { | ||
position: fixed; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
z-index: 99999; | ||
.toast { | ||
width: 340px; | ||
padding: 20px; | ||
border-radius: 6px; | ||
font-size: 14px; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
.content { | ||
span { | ||
padding-left: 10px; | ||
} | ||
} | ||
&.info { | ||
background: #edf2fc; | ||
border: 1px solid #e0eafc; | ||
color: #909399; | ||
} | ||
&.success { | ||
background: #f0f9eb; | ||
border: 1px solid #e7f9de; | ||
color: #67c23a; | ||
} | ||
&.warning { | ||
background: #fdf6ec; | ||
border: 1px solid #f9ecda; | ||
color: #e6a23c; | ||
} | ||
&.error { | ||
background: #fef0f0; | ||
border: 1px solid #fbdfdf; | ||
color: #f56c6c; | ||
} | ||
.close { | ||
cursor: pointer; | ||
color: #909399 | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<template> | ||
<div class="home-container"> | ||
欢迎进入主页 | ||
|
||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'Home', | ||
components: {}, | ||
data() { | ||
return { | ||
} | ||
}, | ||
computed: { | ||
}, | ||
created() {}, | ||
mounted() { | ||
}, | ||
methods: { | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.home-container { | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters