mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-12 12:25:16 +08:00
32 lines
709 B
Markdown
32 lines
709 B
Markdown
# Namespace (Class on Detached DOM)
|
|
Some parts of component are detached to `document.body`. If you want to add a class to those detached elements, use `namespace` prop of `n-config-provider`. Open devtools to see detached part.
|
|
```html
|
|
<n-config-provider :namespace="ns">
|
|
<n-tooltip
|
|
placement="bottom"
|
|
trigger="click"
|
|
>
|
|
<template v-slot:activator>
|
|
<n-button
|
|
@click="isActive = true"
|
|
>
|
|
Activate Component with Detached Content
|
|
</n-button>
|
|
</template>
|
|
<span>
|
|
Detached Part
|
|
</span>
|
|
</n-tooltip>
|
|
</n-config-provider>
|
|
```
|
|
```js
|
|
export default {
|
|
data () {
|
|
return {
|
|
ns: 'custom-app-namespace1',
|
|
isActive: false
|
|
}
|
|
}
|
|
}
|
|
```
|