Stud.IP  6.0
VueApp Class Reference
Inheritance diagram for VueApp:

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)
 

Detailed Description

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.

Author
Jan-Hendrik Willms tleil.nosp@m.ax+s.nosp@m.tudip.nosp@m.@gma.nosp@m.il.co.nosp@m.m
Since
Stud.IP 6.0

Member Function Documentation

◆ __toString()

__toString ( )

Returns a string representation of the vue app by rendering it.

◆ create()

static create ( string  $base_component)
static

Creates a vue app with the given base component.

◆ getBaseComponent()

getBaseComponent ( )

Returns the base component

◆ getComponents()

getComponents ( )

Returns all components

◆ getPlugins()

getPlugins ( )

Returns all plugins

◆ getProps()

getProps ( )

Returns all props

◆ getSlots()

getSlots ( )

Returns all slots

◆ getStoreData()

getStoreData ( )

Returns all store data

◆ getStores()

getStores ( )

Returns all stores

◆ getTemplate()

getTemplate ( )

Returns the template to render the vue app

◆ render()

render ( )

Renders the vue app

◆ withComponent()

withComponent ( string  $component)

Registers a component for use e.g. in slots.

◆ withPlugin()

withPlugin ( string  $plugin,
string  $filename = null 
)

Adds a plugin

You may specify a different filename for the plugin.

◆ withProps()

withProps ( array  $props,
bool  $overwrite = false 
)

Add props

You may choose to overwrite the defined props

◆ withSlot()

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()

withStore ( string  $store,
?string  $index = null,
?array  $data = null 
)

Adds a store


The documentation for this class was generated from the following file: