connect from the q2-tecton-sdk, or from the q2-design-system library.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:
Making use of the Vue component wrappers only requires a couple of steps.
First, you will need to install the framework wrappers library:
npm i q2-tecton-framework-wrappersyarn add q2-tecton-framework-wrapperspnpm add q2-tecton-framework-wrappersThe Vue component wrappers support v-model for two-way data binding on form components. This allows you to bind component values directly to your reactive data without manually handling events.
q2-inputq2-textareaq2-editable-fieldq2-selectq2-checkboxq2-checkbox-groupq2-radio-groupq2-calendarq2-tab-containerq2-paginationOnce 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 lang="ts">
import { defineComponent, ref } from "vue";
import {
Q2Input,
Q2Select,
Q2Checkbox,
Q2Section,
Q2Btn
} from "q2-tecton-framework-wrappers/dist/vue";
export default defineComponent({
components: { Q2Input, Q2Select, Q2Checkbox, Q2Section, Q2Btn },
setup() {
const fullName = ref("");
const selectedOption = ref("");
const isChecked = ref(false);
const onSubmit = () => {
console.log("Submitted:", fullName.value, selectedOption.value, isChecked.value);
};
return { fullName, selectedOption, isChecked, onSubmit };
},
});
</script>
<template>
<q2-section label="My Section" collapsible expanded>
<q2-input label="Full name" v-model="fullName" />
<q2-select label="Choose an option" v-model="selectedOption">
<q2-option value="a">Option A</q2-option>
<q2-option value="b">Option B</q2-option>
</q2-select>
<q2-checkbox label="I agree" v-model="isChecked" />
<q2-btn intent="workflow-primary" @click="onSubmit">Submit</q2-btn>
</q2-section>
</template>