Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ecosystem-vue documentation #608

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion versioned_docs/version-4.x/getting-started-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,4 @@ Read our [contributing guide](https://reactjs.org/contributing/how-to-contribute

See [user showcase](/users).

Is your company or project using single-spa? Let us know by submitting a PR to [this section](https://github.com/single-spa/single-spa.js.org/blob/master/website/src/data/users.js)!
Is your company or project using single-spa? Let us know by submitting a PR to [this section](https://github.com/single-spa/single-spa.js.org/blob/master/src/data/users.js)!
69 changes: 30 additions & 39 deletions versioned_docs/version-5.x/ecosystem-vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,15 @@ const vueLifecycles = singleSpaVue({
Vue,
appOptions: {
render(h) {
return h(App);
return h(App, {
props: {
// single-spa props are available on the "this" object. Forward them to your component as needed.
// https://single-spa.js.org/docs/building-applications#lifecycle-props
name: this.name,
mountParcel: this.mountParcel,
singleSpa: this.singleSpa,
}
});
},
router,
},
Expand Down Expand Up @@ -132,34 +140,40 @@ export const unmount = vueLifecycles.unmount;

## Custom props

[Single-spa custom props](/docs/building-applications/#custom-props) can be passed to your root component like so:
[Single-spa custom props](/docs/building-applications/#custom-props) can be passed to your root component. In your application's entry file, add the props to your root component:

### Vue 2

```js
// main.js
const vueLifecycles = singleSpaVue({
Vue,
appOptions: {
render(h) {
return h(App, {
mountParcel: this.mountParcel,
otherProp: this.otherProp,
props: {
otherProp: this.otherProp,
},
});
},
router,
},
});
```

```vue
// App.vue
<template>
<button>{{ otherProp }}</button>
</template>
<script>
export default {
props: ["mountParcel", "otherProp"],
};
</script>
### Vue 3

```js
const vueLifecycles = singleSpaVue({
Vue,
appOptions: {
render(h) {
return h(App, {
// Notice that this is not within a props object!
otherProp: this.otherProp,
});
},
router,
},
});
```

## Shared dependencies
Expand Down Expand Up @@ -231,29 +245,6 @@ const vueLifecycles = singleSpaVue({
});
```

## Custom Props

[single-spa custom props](/docs/building-applications#custom-props) are available in the `render()` function in your main file. They can be passed as custom props to your App component.

```js
const vueLifecycles = singleSpaVue({
Vue,
appOptions: {
render(h) {
return h(App, {
props: {
// single-spa props are available on the "this" object. Forward them to your component as needed.
// https://single-spa.js.org/docs/building-applications#lifecycle-props
name: this.name,
mountParcel: this.mountParcel,
singleSpa: this.singleSpa,
},
});
},
},
});
```

## Parcels

### Creating a parcel
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-5.x/getting-started-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,4 @@ Read our [contributing guide](/docs/contributing-overview/) to learn about our d

See [user showcase](/users).

Is your company or project using single-spa? Let us know by submitting a PR to [this section](https://github.com/single-spa/single-spa.js.org/blob/master/website/src/data/users.js)!
Is your company or project using single-spa? Let us know by submitting a PR to [this section](https://github.com/single-spa/single-spa.js.org/blob/master/src/data/users.js)!
69 changes: 30 additions & 39 deletions versioned_docs/version-6.x/ecosystem-vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,15 @@ const vueLifecycles = singleSpaVue({
Vue,
appOptions: {
render(h) {
return h(App);
return h(App, {
props: {
// single-spa props are available on the "this" object. Forward them to your component as needed.
// https://single-spa.js.org/docs/building-applications#lifecycle-props
name: this.name,
mountParcel: this.mountParcel,
singleSpa: this.singleSpa,
}
});
},
router,
},
Expand Down Expand Up @@ -132,34 +140,40 @@ export const unmount = vueLifecycles.unmount;

## Custom props

[Single-spa custom props](/docs/building-applications/#custom-props) can be passed to your root component like so:
[Single-spa custom props](/docs/building-applications/#custom-props) can be passed to your root component. In your application's entry file, add the props to your root component:

### Vue 2

```js
// main.js
const vueLifecycles = singleSpaVue({
Vue,
appOptions: {
render(h) {
return h(App, {
mountParcel: this.mountParcel,
otherProp: this.otherProp,
props: {
otherProp: this.otherProp,
},
});
},
router,
},
});
```

```vue
// App.vue
<template>
<button>{{ otherProp }}</button>
</template>
<script>
export default {
props: ["mountParcel", "otherProp"],
};
</script>
### Vue 3

```js
const vueLifecycles = singleSpaVue({
Vue,
appOptions: {
render(h) {
return h(App, {
// Notice that this is not within a props object!
otherProp: this.otherProp,
});
},
router,
},
});
```

## Shared dependencies
Expand Down Expand Up @@ -231,29 +245,6 @@ const vueLifecycles = singleSpaVue({
});
```

## Custom Props

[single-spa custom props](/docs/building-applications#custom-props) are available in the `render()` function in your main file. They can be passed as custom props to your App component.

```js
const vueLifecycles = singleSpaVue({
Vue,
appOptions: {
render(h) {
return h(App, {
props: {
// single-spa props are available on the "this" object. Forward them to your component as needed.
// https://single-spa.js.org/docs/building-applications#lifecycle-props
name: this.name,
mountParcel: this.mountParcel,
singleSpa: this.singleSpa,
},
});
},
},
});
```

## Parcels

### Creating a parcel
Expand Down
2 changes: 1 addition & 1 deletion versioned_docs/version-6.x/getting-started-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,4 @@ Read our [contributing guide](/docs/contributing-overview/) to learn about our d

See [user showcase](/users).

Is your company or project using single-spa? Let us know by submitting a PR to [this section](https://github.com/single-spa/single-spa.js.org/blob/master/website/src/data/users.js)!
Is your company or project using single-spa? Let us know by submitting a PR to [this section](https://github.com/single-spa/single-spa.js.org/blob/master/src/data/users.js)!
Loading