Replies: 2 comments
-
@mtomov Haha, I was Googling how to get this to work on our application. Yours was the top result. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Actually I did manage to get it to work at the end. I created a vue component: <template>
<turbo-frame
:src="url"
:id="'frame-' + frameIdentifier"
@turbo:before-frame-render="handleBeforeRender"
>
<component :is="fetchedComponent"></component>
</turbo-frame>
</template>
<script>
const frameIdentifier = Math.random().toString(36).substring(8)
export default {
props: {
url: String,
},
data() {
return {
html: null,
}
},
computed: {
fetchedComponent() {
return {
template: this.html || "",
}
},
frameIdentifier() {
return frameIdentifier
},
},
methods: {
handleBeforeRender(event) {
// override default render function
event.detail.render = (_currentElement, newElement) => {
this.html = newElement.innerHTML
}
},
},
}
</script> Then, in another <vue-turbo-frame :url="turboFrameUrl"> </vue-turbo-frame> When instantiating the const app = createApp({ // ....
app.config.compilerOptions.isCustomElement = (tag) =>
tag.startsWith("trix") || tag.startsWith("turbo") |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
Thanks for
vite_ruby
!Wanted to see if anyone has managed to get turbo frames to work with VueJS components.
Currently, new html that appears in a
<turbo-frame>
and has vuejs components is not parsed/initialized by VueJS. Wonder if we need to do something likethoughts?
Beta Was this translation helpful? Give feedback.
All reactions