In my functions.php file I have this code:
// Load both vue from the CDN as well as the scripts for the slideout cart and checkout
function load_vue_scripts()
{
$scriptpath = (get_stylesheet_directory_uri() . "/vue/slideout-cart/dist/slideout-cart.js");
wp_register_script('vuejs_source', 'https://cdn.jsdelivr.net/npm/vue/dist/vue.js');
wp_register_script('slideout-cart', "{$scriptpath}", 'vuejs_source', 1, true);
plugin_dir_url(__FILE__) . "vue-cart/public/img"]);
// echo $scriptpath;
wp_enqueue_script('vuejs_source', 'https://cdn.jsdelivr.net/npm/vue/dist/vue.js');
wp_enqueue_script('slideout-cart', "$scriptpath", 'vuejs_source', 1, true);
}
This loads Vuejs from the jsdelivr CDN, as well as loads my script from my the dist directory in my Vue app.
Then, I create a div like so for my app to mount on:
<div id="slideout-cart" class="container" role="main"></div>
Then, I tell my app to mount on that div:
new Vue({
router,
store,
render: (h) => h(App),
}).$mount("#slideout-cart");
I see the script in my source tab on chrome, and I even see the console.log()'s coming from the app, but nothing is rendered. What am I doing wrong?