Home › Forums › Support › How do I add Vue.js? This topic has 5 replies, 3 voices, and was last updated 2 years, 4 months ago by Elvin. Viewing 6 posts - 1 through 6 (of 6 total) Author Posts November 28, 2021 at 1:40 pm #2028194 Robert I am trying to use a new hook element to add some vue.js code but I’m not having any luck. Is there a simple way to add vue just to generatepress? November 28, 2021 at 3:06 pm #2028260 YingStaff Customer Support Hi Robert, You can wrap the JS code with <script></script> in the hook element, set the hook name to wp_footer, choose location as your needs. Let me know if this helps π November 28, 2021 at 4:15 pm #2028334 Robert I did that, and then on the page I created an html element with id=”app”, like so: <div id="app"> {{ message }} </div> In the hook this is what I have: <script> var app = new Vue({ el: '#app', data: { message: 'Hello Vue!' } }) </script> I also have a separate element to load in the vue script: <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script> Am I missing something? November 28, 2021 at 5:26 pm #2028390 ElvinStaff Customer Support Hi Robert, Create 2 Hook Elements. On the first hook, set it’s hook to wp_head and add this one: <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script> On the second hook, set it’s hook to wp_footer and add your vue js init script. <script> var app = new Vue({ el: '#app', data: { message: 'Hello Vue!' } }) </script> After setting this up, your <div id="app"> w/ {{...}} element should work. π November 28, 2021 at 7:44 pm #2028472 Robert Wow this is amazing, you guys are the best! November 28, 2021 at 9:58 pm #2028569 ElvinStaff Customer Support No problem. Glad to be of any help. π Author Posts Viewing 6 posts - 1 through 6 (of 6 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In