Stud.IP
6.0
|
Public Member Functions | |
getBaseComponent () | |
withProps (array $props, bool $overwrite=false) | |
getProps () | |
withSlot (string $name, string|Template $content) | |
getSlots () | |
withStore (string $store, ?string $index=null, ?array $data=null) | |
getStores () | |
getStoreData () | |
withPlugin (string $plugin, string $filename=null) | |
getPlugins () | |
withComponent (string $component) | |
getComponents () | |
getTemplate () | |
render () | |
__toString () | |
Static Public Member Functions | |
static | create (string $base_component) |
PHP abstraction of vue app
The VueApp is used to create a Vue app in a general way. Just create it using the name of the case component and pass in any required props or stores including initial data.
The store data is passed as an associative array where the key is the name of the mutation to call with the given value as data.
All methods are written in fluid manner so that you can create the app like this:
<?= Studip::create('ExampleComponent') ->withProps(['foo' => 'bar']) ->withStore('exampleStore', data: ['setBar' => 'baz']) ?>
All with* methods will always create a new cloned instance so the original instance is immutable.
__toString | ( | ) |
Returns a string representation of the vue app by rendering it.
|
static |
Creates a vue app with the given base component.
getBaseComponent | ( | ) |
Returns the base component
getComponents | ( | ) |
Returns all components
getPlugins | ( | ) |
Returns all plugins
getProps | ( | ) |
Returns all props
getSlots | ( | ) |
Returns all slots
getStoreData | ( | ) |
Returns all store data
getStores | ( | ) |
Returns all stores
getTemplate | ( | ) |
Returns the template to render the vue app
render | ( | ) |
Renders the vue app
withComponent | ( | string | $component | ) |
Registers a component for use e.g. in slots.
withPlugin | ( | string | $plugin, |
string | $filename = null |
||
) |
Adds a plugin
You may specify a different filename for the plugin.
withProps | ( | array | $props, |
bool | $overwrite = false |
||
) |
Add props
You may choose to overwrite the defined props
withSlot | ( | string | $name, |
string|Template | $content | ||
) |
Add a slot with the given name
If you pass a flexi template as the content, it will be rendered.
withStore | ( | string | $store, |
?string | $index = null , |
||
?array | $data = null |
||
) |
Adds a store