package com.axellience.vuegwtexamples.client.examples.recursive;

import com.axellience.vuegwt.core.client.component.VueComponent;
import com.axellience.vuegwt.core.client.component.hooks.HasCreated;
import com.axellience.vuegwt.core.annotations.component.Component;
import com.axellience.vuegwt.core.annotations.component.Prop;
import jsinterop.annotations.JsProperty;

/**
 * @author Adrien Baron
 */
@Component(name = "recursive")
public class RecursiveComponent extends VueComponent implements HasCreated
{
    @Prop
    @JsProperty
    Integer counter;

    @Override
    public void created()
    {
        if (this.counter == null)
            this.counter = 0;
    }
}

package com.axellience.vuegwtexamples.client.examples.recursive;

import com.axellience.vuegwt.core.annotations.component.Component;
import com.axellience.vuegwt.core.annotations.component.Prop;
import com.axellience.vuegwt.core.annotations.component.PropDefault;
import com.axellience.vuegwt.core.client.component.VueComponent;
import jsinterop.annotations.JsProperty;

/**
 * @author Adrien Baron
 */
@Component(name = "recursive")
public class RecursiveComponent extends VueComponent
{
    @Prop
    @JsProperty
    int counter;

    @PropDefault(propertyName = "counter")
    public int defaultCounter()
    {
        return 0;
    }
}

Fix RecursiveComponent that broke with Elemental2 Any in template