Created
March 29, 2021 16:00
-
-
Save Volmarg/aad69945a95937cacca9ac0b6412c824 to your computer and use it in GitHub Desktop.
PreconfiguredVue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class PreconfiguredVue | |
{ | |
/** | |
* @description delimiters used to translate vue logic, required since twig utilizes the `{{ }}` | |
*/ | |
static readonly VUE_DEFAULT_DELIMITERS = ["[[", "]]"]; | |
/** | |
* @description creates vue instance for dom element but uses preconfigured vue with common reusable logic, | |
* this provides the same output as creating SPA with vue in root such as body | |
* | |
* @param domElementSelector | |
* @param options | |
*/ | |
public static createApp(domElementSelector: string, options) | |
{ | |
//@ts-ignore | |
options.delimiters = PreconfiguredVue.VUE_DEFAULT_DELIMITERS; | |
let vueApp = vue.createApp(options); | |
vueApp.mount(domElementSelector); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment