Adds 'deps' argument to register_vuejs_component #473.

This commit is contained in:
mateuswetah 2021-01-18 11:10:46 -03:00
parent 3beef4c9a3
commit 21e832a3ce
1 changed files with 5 additions and 3 deletions

View File

@ -37,11 +37,13 @@ class Component_Hooks {
public function register_component() { public function register_component() {
do_action('tainacan-register-vuejs-component', $this); do_action('tainacan-register-vuejs-component', $this);
foreach($this->registered_component as $handle => $component) { foreach($this->registered_component as $handle => $component) {
$deps = isset($component['args']['deps']) ? $component['args']['deps'] : [];
if ( is_admin() ) { if ( is_admin() ) {
wp_enqueue_script($handle, $component['script_path']); wp_enqueue_script($handle, $component['script_path'], $deps);
} else { } else {
if (isset($component['args']['public']) == true && $component['args']['public'] != false) { if (isset($component['args']['public']) == true && $component['args']['public'] != false) {
wp_enqueue_script($handle, $component['script_path']); wp_enqueue_script($handle, $component['script_path'], $deps);
} }
} }
} }