Skip to content

chore: comment another watch usage, timeout message box #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/components/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<script>
// referenced on
// https://github.com/vuejs/vue-next/blob/master/packages/sfc-playground/src/Message.vue
import { computed, toRefs } from 'vue'
import { computed, toRefs, watch } from 'vue'
import { msg } from '../store.js'

export default {
Expand All @@ -34,6 +34,14 @@ export default {
background: color.value + '33'
}
})
watch(
() => msg.showMsg,
() => {
if (msg.showMsg) {
setTimeout(() => (msg.showMsg = false), 5000)
}
}
)

return { message, color, style, msg }
}
Expand Down
1 change: 1 addition & 0 deletions src/components/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export default {

const downloadProject = () => {
if (store.code && Object.keys(store.code).length) {
msg.color = '#ff0000'
if (!store.config.output_dir) {
msg.showMsg = true
msg.content = `Output directory is required. Please input in Loggers tab.`
Expand Down
1 change: 1 addition & 0 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export async function fetchTemplates(template) {

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

// ejs options
Expand Down