karannagupta/wordpress-vuejs-search

Can't access the wordpress local data inside vuejs

Opened this issue · 0 comments

I can't access the local WordPress data in Vuejs. I followed all your instructions which are given about but it's not working for me. Please help me to how to slove it

wordpress code -

get_stylesheet_directory_uri(), 'rest_url' => untrailingslashit( esc_url_raw( rest_url() ) ), // URL to the REST endpoint. 'app_path' => '$post->post_name', // page where the custom page template is loaded. 'post_categories' => get_terms( array( 'taxonomy' => 'category', // default post categories. 'hide_empty' => true, 'fields' => 'names', ) ), ) ); // enqueue the Vue app script with localized data. wp_enqueue_script( 'vue_search_app' ); //} } VueJs code - App.Vue ----------------------------------------------------- data() { return { wpData: wpData, } } ** When I access this wpData it's shown me an error and undefined