const DataInitializerMixin = {
    created: function () {
        this.loadDataFromProps_();
    },
    methods: {
        loadDataFromProps_: function () {
            this.propagateSlotsData_(this._props);
        },
        propagateSlotsData_: function (data) {
            for (let field in data)
            {
                let name = field + '_';
                if (this.hasOwnProperty(name) && typeof data[field] != 'undefined')
                {
                    try
                    {
                        this[name] = JSON.parse(data[field]);
                    }
                    catch (ex)
                    {
                        this[name] = data[field];
                    }
                }
                
            }
        }
    },
    watch: {
        $props: {
            handler()
            {
                this.loadDataFromProps_();
            },
            deep: true,
            immediate: true,
        },
    },
}