Vue Component Wrappers
- Updated:
This tutorial assumes your codebase is registering the Web Components via connect
from the q2-tecton-sdk
, or from the q2-design-system
library (Guide).
If you're using Vue to build out your feature or application, then you can make use of the Vue component wrappers that are published as a part of Tecton.
This gives you a number of benefits including:
- Autocompletion
- Better event handling
- Type safety
Getting started
Making use of the Vue component wrappers only requires a couple of steps.
First, you will need to install the framework wrappers library:
- NPM:
npm i q2-tecton-framework-wrappers
- Yarn:
yarn add q2-tecton-framework-wrappers
Using the components
Once the package is installed you can start using the components by importing the ones you need, just like you would with any other components. They are all located in q2-tecton-framework-wrappers/dist/vue
.
<script>
import {
Q2Input,
Q2Section,
Q2Btn,
} from "q2-tecton-framework-wrappers/dist/vue";
const onFullNameInput = (event) => {
const {
detail: { value },
} = event;
console.log(value);
};
</script>
<template>
<Q2Section label="My Section" collapsible expanded>
<Q2Input label="Full name" optional @input="onFullNameInput" />
<Q2Btn intent="workflow-primary">Submit</Q2Btn>
</Q2Section>
</template>