Skip to content

Commit 3afba9e

Browse files
committed
chore: comment another watch usage, timeout message box (#122)
1 parent df41cc6 commit 3afba9e

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/components/Message.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<script>
1212
// referenced on
1313
// https://github.com/vuejs/vue-next/blob/master/packages/sfc-playground/src/Message.vue
14-
import { computed, toRefs } from 'vue'
14+
import { computed, toRefs, watch } from 'vue'
1515
import { msg } from '../store.js'
1616
1717
export default {
@@ -34,6 +34,14 @@ export default {
3434
background: color.value + '33'
3535
}
3636
})
37+
watch(
38+
() => msg.showMsg,
39+
() => {
40+
if (msg.showMsg) {
41+
setTimeout(() => (msg.showMsg = false), 5000)
42+
}
43+
}
44+
)
3745
3846
return { message, color, style, msg }
3947
}

src/components/NavBar.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export default {
101101
102102
const downloadProject = () => {
103103
if (store.code && Object.keys(store.code).length) {
104+
msg.color = '#ff0000'
104105
if (!store.config.output_dir) {
105106
msg.showMsg = true
106107
msg.content = `Output directory is required. Please input in Loggers tab.`

src/store.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export async function fetchTemplates(template) {
9393

9494
// watch the store.config
9595
// if that changed, call the genCode function
96+
// same as watch(() => store.config, () => genCode(), { deep: true })
9697
watch(store.config, () => genCode())
9798

9899
// ejs options

0 commit comments

Comments
 (0)