naive-ui/demo/documentation/components/message/enUS/aboutTheme.md
songwanli2025@163.com 4f90dd3b05 merge from upstream
2019-12-17 14:36:37 +08:00

634 B

Caveat About Theme

Wherever you use this.$NMessage to generate a message, if you don't specify the theme of it, the theme of created message will follow the outer-most ascendant Config Provider of this. Making the message's theme as same as its invoking component instance will cause chaos.

<n-button @click="emitInfo">
  You can change the theme while the message is active
</n-button>
export default {
  data() {
    return {}
  },
  methods: {
    emitInfo() {
      this.$NMessage.info(
        "I don't know why nobody told you how to unfold your love",
        { duration: 5000 }
      )
    }
  }
}