naive-ui/demo/documentation/components/notification/zhCN/closable.demo.md
2020-10-22 19:14:56 +08:00

765 B

不可关闭

通知可以不能被关闭

<n-button @click="handleClick">
  不能关闭
</n-button>
export default {
  inject: ['notification'],
  methods: {
    handleClick () {
      const notification = this.notification
      notification.create({
        title: '你能关掉我吗?',
        duration: 2000,
        closable: false,
        onAfterLeave: () => {
          notification.create({
            title: `哈哈哈哈!`,
            duration: 2000,
            closable: false,
            onAfterLeave: () => {
              notification.create({
                title: `你不能`,
                duration: 2000,
                closable: false
              })
            }
          })
        }
      })
    }
  }
}