Views: 3973
Last Modified: 15.02.2023
  • If you need to get access to original Vue 3 methods (for example, to createApp), you can do that using standard import:

    import {createApp} from "ui.vue3";
    
    createApp({
    	data()
    	{
    		return {
    			counter: 0
    		}
    	},
    	mounted()
    	{
    		setInterval(() => {
    			this.counter++
    		}, 1000)
    	},
    	// language=Vue
    	template: `
    		Counter: {{ counter }}
    	`
    }).mount('#application');
    

  • When you need to connect Bitrix Framework integration plugin ($Bitrix): it can be done using .use(BitrixVue):

    import {createApp, BitrixVue} from "ui.vue3";
    
    const application = createApp({
    	// language=Vue
    	template: `
    		Current UserID: {{ $Bitrix.Loc.getMessage('USER_ID') }}
    	`
    })
    application.use(BitrixVue);
    application.mount('#application');
    

  • Use the namespace BX.Vue3 for working within inline scripts at the standard page and in scripts without transpiling:

    const application = BX.Vue3.createApp({
    	// language=Vue
    	template: `
    		Current UserID: {{ $Bitrix.Loc.getMessage('USER_ID') }}
    	`
    })
    application.use(BX.Vue3.BitrixVue);
    application.mount('#application');
    





Courses developed by Bitrix24