diff --git a/src/notify/README.md b/src/notify/README.md index 0bfbb2307..4b66d5ed7 100644 --- a/src/notify/README.md +++ b/src/notify/README.md @@ -65,19 +65,23 @@ export default { ``` ```js +import { ref } from 'vue'; + export default { - data() { - return { - show: false, - }; - }, - methods: { - showNotify() { - this.show = true; + setup() { + const show = ref(false); + + const showNotify = () => { + show.value = true; setTimeout(() => { - this.show = false; + show.value = false; }, 2000); - }, + }; + + return { + show, + showNotify, + }; }, }; ``` diff --git a/src/notify/README.zh-CN.md b/src/notify/README.zh-CN.md index 417df18ae..122bc6557 100644 --- a/src/notify/README.zh-CN.md +++ b/src/notify/README.zh-CN.md @@ -102,19 +102,23 @@ export default { ``` ```js +import { ref } from 'vue'; + export default { - data() { - return { - show: false, - }; - }, - methods: { - showNotify() { - this.show = true; + setup() { + const show = ref(false); + + const showNotify = () => { + show.value = true; setTimeout(() => { - this.show = false; + show.value = false; }, 2000); - }, + }; + + return { + show, + showNotify, + }; }, }; ``` diff --git a/src/notify/demo/index.vue b/src/notify/demo/index.vue index 2d3522267..7a10b2b57 100644 --- a/src/notify/demo/index.vue +++ b/src/notify/demo/index.vue @@ -23,80 +23,91 @@ - + {{ t('content') }} -