Class VueComponent

java.lang.Object
io.github.jeemv.springboot.vuejs.AbstractVueJS
io.github.jeemv.springboot.vuejs.components.VueComponent

public class VueComponent extends AbstractVueJS
VueJS component class This class is part of springBoot-VueJS Components are created in src/main/resources/static/
  • Constructor Details

    • VueComponent

      public VueComponent()
    • VueComponent

      public VueComponent(String name)
    • VueComponent

      public VueComponent(String name, boolean internal)
  • Method Details

    • getScript

      public String getScript()
      Description copied from class: AbstractVueJS
      Returns the generated script creating the instance
      Specified by:
      getScript in class AbstractVueJS
      Returns:
      the generated script (javascript)
    • getName

      public String getName()
    • getTemplate

      public String getTemplate()
    • setTemplate

      public VueComponent setTemplate(String template)
      Defines the template string
      Parameters:
      template -
      Returns:
      VueComponent
    • setTemplateFile

      public VueComponent setTemplateFile(String pathFilename)
      Sets a template file
      Parameters:
      pathFilename -
      Returns:
      VueComponent
    • setDefaultTemplateFile

      public VueComponent setDefaultTemplateFile()
      Sets the default template file (componentName+".html")
    • isInternal

      public boolean isInternal()
    • setInternal

      public void setInternal(boolean internal)
      Defines if the component is created in the vue instance or not
      Parameters:
      internal -
    • getProps

      public VueProps getProps()
    • setProps

      public VueComponent setProps(String... props)
      Sets the component properties
      Parameters:
      props -
      Returns:
      VueComponent
    • addProp

      public VueProp addProp(String name, Object defaultValue)
      Adds a new property to the component
      Parameters:
      name - The property name
      defaultValue - The property default value
      Returns:
    • addPropRaw

      public VueProp addPropRaw(String name, String defaultValue)
      Adds a new property to the component defaultValue is not quoted (because it's a raw property)
      Parameters:
      name - The property name
      defaultValue - non quoted value
      Returns:
    • addProp

      public VueProp addProp(String name, String type, boolean required)
      Adds a required property to the component
      Parameters:
      name - The property name
      type - The property type
      required - true if the property is required
      Returns:
    • addProp

      public VueProp addProp(String name, String type, boolean required, boolean mutable)
      Adds a mutable property (use mutProperty=value to assign a value)
      Parameters:
      name - then name of the property
      type - the property type (Object,Array,Function,String,Number,Boolean)
      required - if true property is required
      mutable - if true property is mutable
      Returns:
      the property added
    • loadTemplateFile

      protected void loadTemplateFile(String filename) throws IOException
      Throws:
      IOException
    • createFile

      public void createFile(String pathFilename, boolean minify) throws IOException
      Generates a new VueJS component and save it to a file
      Parameters:
      pathFilename - the path file name (from static folder)
      minify - if true minify the javascript source code
      Throws:
      IOException - for file creation
    • createFile

      public void createFile(boolean minify) throws IOException
      Throws:
      IOException
    • globalJs

      public static void globalJs()
    • globalJs

      public static void globalJs(String... files) throws IOException
      Throws:
      IOException