naive-ui/demo/documentation/components/configConsumer/enUS/basic.md
2019-11-09 22:45:07 +08:00

588 B

Basic

<n-config-consumer
  @theme-change="handleThemeChange"
  @namespace-change="handleNamespaceChange"
>
  <template slot-scope="{ theme, namespace }">
    <div>
      <div>theme: {{ theme }}</div>
      <div>namespace: {{ namespace }}</div>
    </div>
  </template>
</n-config-consumer>
export default {
  methods: {
    handleThemeChange (value, oldValue) {
      this.$NMessage.info('Theme Change: `' + value + '` theme')
    },
    handleNamespaceChange (value, oldValue) {
      this.$NMessage.info('Namespace Change: `' + value + '` namespace')
    }
  }
}