The compare component (Vvveb\Component\Compare) is a placeholder for the product-comparison feature. It declares no options ($defaultOptions is empty) and its results() method only triggers the Vvveb\Component\Compare::results event, returning whatever listeners provide.

Activate the component by adding:

data-v-component-compare

Component Options

None. The component accepts no data-v-* options. Comparison data is supplied by event listeners or plugin code.

Component Properties

No built-in properties. Any data assigned by event listeners is exposed to the template under the compare component key.

HTML Example

<div data-v-component-compare>
	<!-- comparison table rendered by event-provided data -->
</div>

Notes

  • To implement comparison, listen for Vvveb\Component\Compare::results with Event::on('Vvveb\Component\Compare', 'results', $id, $callback) and return [$results].
  • Product add-to-compare URLs are available on product data as data-v-product-add_compare_url.