Vue UI Components Documentation
The Vue ComplexInput enables the user to edit complex and scientific numbers. This guide adds the Vue ComplexInput (jqxComplexInput) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-scriptsjqwidgets-scripts/jqwidgets-vue3/vue_jqxcomplexinput.vue 
In a Vue 3 project (to start one, see Getting started with Vue), add the package:
npm install jqwidgets-scripts
import JqxComplexInput from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxcomplexinput.vue';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.base.css';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.tailwind-blue-dark.css';
With <script setup>, an imported component is ready to use in the template. jqx.base.css is required; the second file is a theme, selected with the theme attribute.
The Default Functionality demo as a Single-File Component:
<template>
<div>
<JqxComplexInput ref="myComplexInput" :width="250" :height="25" :value="'15 + 7.2i'">
</JqxComplexInput>
<div style="margin-top: 20px">
<JqxButton @click="getRealPart()" :width="150"> Get real part </JqxButton>
<JqxButton @click="getImaginaryPart()" :width="150"> Get imaginary part </JqxButton>
</div>
</div>
</template>
<script setup>
import { ref } from 'vue';
import JqxComplexInput from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxcomplexinput.vue';
import JqxButton from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxbuttons.vue';
const myComplexInput = ref(null);
function getRealPart() {
let realPart = myComplexInput.value.getReal();
alert(`Real part is ${realPart}`);
}
function getImaginaryPart() {
let imaginaryPart = myComplexInput.value.getImaginary();
alert(`Imaginary part is ${imaginaryPart}`);
}
</script>
<style>
.jqx-button {
display: inline-block;
margin-right: 5px;
}
</style>
Options are attributes. Bind values from the script with :, for example :width="850".
Listen to an event with @ and its name. For example, change: This event is triggered when the value is changed.
<script setup>
function onChange(event) {
console.log(event.args);
}
</script>
<template>
<JqxComplexInput @change="onChange" />
</template>
Call methods through a template ref. For example, val: Sets or gets the value.
<script setup>
import { ref, onMounted } from 'vue';
const myComplexInput = ref(null);
onMounted(() => {
const value = myComplexInput.value.val();
console.log(value);
});
</script>
<template>
<JqxComplexInput ref="myComplexInput" />
</template>
Every component also has setOptions({ … }) and getOptions('name').