Views: 1963
Last Modified: 28.04.2022
  • If you have used global variables within your components (often when initializing Vue application), now you have a specialized class $Bitrix.Data.

    Before:

    this.$root.$variable = 'xyz';
    console.log(this.$root.$variable);
    

    Now:

    this.$Bitrix.Data.set('variale', 'xyz');
    this.$Bitrix.Data.get('variale');
    

  • If you have previously retrieved a value, and indicated the default value if its unavailable - now your call can be simplified.

    Before:

    let variable;
    if (typeof this.$root.$variable !== 'undefined')
    {
    	variable = this.$root.$variable;
    }
    else
    {
    	variable = 'defaultValue';
    }
    

    Now:

    this.$Bitrix.Data.get('variable', 'defaultValue');
    

You can find more details on the class $Bitrix.Data in the article: Class for handling global data.





Courses developed by Bitrix24