Vue.js inside of Hype


(steve) #1

Has anyone worked with or know about using Vue.js inside of Hype? To be clear, I’m not asking about embedding a Hype document inside a Vue.js app but rather including the Vue library inside a Hype document and using it to manage DOM etc. For those not familiar, Vue.js is a very popular and very lightweight Javascript library similar to React. For what I’m doing, this would not be overkill, but I’m assuming it could work and just wanted to check and see if others have tried to do something similar.


(steve) #3

One issue that occurs to me is that in Hype, we get elements using HypeDocument.getElement . . . whereas a framework like view would need to get access the DOM directly. Would this be a problem?


(Jonathan Deutsch) #4

I don’t have experience using this, but in regards to the hypeDocument.getElementById vs. document.getElementById, the only difference is that the hypeDocument one is more resilient in the face of conflicts caused by multiple hype documents on a single .html page. Hype absolutely requires unique element IDs, so it may rename your requested ID in a case of collision. If there’s no collisions it is identical to document.getElementById. Hype does do a lot of management of the DOM itself, so I’d think there are possibilities of Vue.js and Hype’s views of the world differing and causing issues, but who knows :).


(steve) #5

Thanks @jonathan. There would definitely only be one Hype document per page, so that doesn’t seem like it would be a problem. That’s good to know. Also, I would only be operating on rects with inner html set dynamically - no video or other Hype Elements being used. Hype actually makes a good client for a web app.


(Jonathan Deutsch) #6

If there’s any tips or tricks you come up with, please do share those!