Stud.IP
6.1
|
Public Member Functions | |
getAppPath () | |
withProps (array $props, bool $overwrite=false) | |
getProps () | |
setSlot (string $name, string|Template $content) | |
withSlot (string $name, string|Template $content) | |
withSlots (array $slots, bool $overwrite=false) | |
getSlots () | |
withStore (string $store, ?string $command=null, ?array $data=null) | |
getStores () | |
getStoreData () | |
withVuexStore (string $store, ?string $index=null, ?array $data=null) | |
getVuexStores () | |
getVuexStoreData () | |
withPlugin (string $plugin, string $filename=null) | |
getPlugins () | |
getTemplate () | |
render () | |
__toString () | |
Static Public Member Functions | |
static | create (string $appPath) |
PHP abstraction of vue app
The VueApp is used to create a Vue app in a general way. Just create it using the relative path of the app 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('ExampleApp') ->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 relative path to the app component.
getAppPath | ( | ) |
Returns the relative path to the app component.
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
getVuexStoreData | ( | ) |
Returns all vuex store data
getVuexStores | ( | ) |
Returns all vuex stores
render | ( | ) |
Renders the vue app
setSlot | ( | string | $name, |
string|Template | $content | ||
) |
Set the content of a slot.
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.
withSlots | ( | array | $slots, |
bool | $overwrite = false |
||
) |
Add slots
You may choose to overwrite the defined slots
withStore | ( | string | $store, |
?string | $command = null , |
||
?array | $data = null |
||
) |
Adds a store
withVuexStore | ( | string | $store, |
?string | $index = null , |
||
?array | $data = null |
||
) |
Adds a vuex store