You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BREAKING CHANGE:
* the component is renamed from `<no-ssr>` to `<client-only>`
* the class name for the placeholder is renamed from `no-ssr-placeholder` to `client-only-placeholder`
> __This branch is for latest version, switch to [1.x](https://github.com/egoist/vue-client-only/tree/1.x) branch for the `vue-no-ssr` docs.__
12
+
11
13
## Usage
12
14
13
15
```vue
14
16
<template>
15
17
<div id="app">
16
18
<h1>My Website</h1>
17
-
<no-ssr>
19
+
<client-only>
18
20
<!-- this component will only be rendered on client-side -->
19
21
<comments />
20
-
</no-ssr>
22
+
</client-only>
21
23
</div>
22
24
</template>
23
25
24
26
<script>
25
-
import NoSSR from 'vue-no-ssr'
27
+
import ClientOnly from 'vue-client-only'
26
28
27
29
export default {
28
30
components: {
29
-
'no-ssr': NoSSR
31
+
ClientOnly
30
32
}
31
33
}
32
34
</script>
33
35
```
34
36
35
37
### Placeholder
36
38
37
-
Use a slot or text as placeholder until `<no-ssr />` is mounted on client-side.
39
+
Use a slot or text as placeholder until `<client-only />` is mounted on client-side.
38
40
39
41
eg, show a loading indicator.
40
42
@@ -43,23 +45,23 @@ eg, show a loading indicator.
43
45
<div id="app">
44
46
<h1>My Website</h1>
45
47
<!-- use slot -->
46
-
<no-ssr>
48
+
<client-only>
47
49
<comments />
48
50
<comments-placeholder slot="placeholder" />
49
-
</no-ssr>
51
+
</client-only>
50
52
<!-- or use text -->
51
-
<no-ssr placeholder="Loading...">
53
+
<client-only placeholder="Loading...">
52
54
<comments />
53
-
</no-ssr>
55
+
</client-only>
54
56
</div>
55
57
</template>
56
58
57
59
<script>
58
-
import NoSSR from 'vue-no-ssr'
60
+
import ClientOnly from 'vue-client-only'
59
61
60
62
export default {
61
63
components: {
62
-
'no-ssr': NoSSR
64
+
ClientOnly
63
65
}
64
66
}
65
67
</script>
@@ -68,21 +70,21 @@ eg, show a loading indicator.
68
70
By default the placeholder will be wrapped in a `div` tag, however you can use `placeholderTag` prop to customize it:
0 commit comments