Skip to content

Latest commit

 

History

History
67 lines (49 loc) · 5.73 KB

README.md

File metadata and controls

67 lines (49 loc) · 5.73 KB

Vue Dadata

This is a fork of this Vue component, which provides address suggestions using DaData.ru.

It targets Vue 3.5+.

For Vue 2 and earlier Vue 3 versions (pre-3.5), please refer to Ivan Monastyrev's original repository.

Install

$ pnpm install git+https://github.com/rusproject/vue-dadata.git#rewritten

Usage

<script lang="ts" setup>
import { ref } from 'vue';
import { VueDadata } from 'vue-dadata';
import 'vue-dadata/dist/vue-dadata.css';

const token = import.meta.env.VITE_APP_DADATA_API_KEY as string;

const query = ref('');
const suggestion = ref(undefined);
</script>

<template>
  <div>
    <VueDadata v-model="query" v-model:suggestion="suggestion" :token="token" />
  </div>
</template>

Properties

Prop Required Type Description Default
token Yes string Auth token DaData.ru -
modelValue Yes string v-model for query -
suggestion No object v-model for suggestion undefined
placeholder No string Text placeholder ''
url No string special url for dadata api 'https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/address'
debounceWait No number waiting time '100ms'
disabled No boolean disabled false
fromBound No string Dadata bound type FROM undefined
toBound No string Dadata bound type TO undefined
inputName No string Input name attribute 'vue-dadata-input'
locationOptions No object Location options for choosing cities or countries undefined
classes No object classes DEFAULT_CLASSES
highlightOptions No object highlight options for vue-word-highlighter DEFAULT_HIGHLIGHT_OPTIONS
selectOnBlur No boolean if true, automatically select suitable suggestion when input loses focus undefined

Peer dependencies

Dependencies

Forked from ikloster03/vue-dadata