|
| 1 | +<template> |
| 2 | + <div id="app"> |
| 3 | + <div style="margin:10% 25%; width: 250px;"> |
| 4 | + <br> |
| 5 | + <ejs-autocomplete :dataSource='dataItem' :fields='dataFields' |
| 6 | + placeholder="Select a name" popupWidth="250px" |
| 7 | + popupHeight="400px" :query='dataQuery' :highlight="true"> |
| 8 | + </ejs-autocomplete> |
| 9 | + </div> |
| 10 | + </div> |
| 11 | +</template> |
| 12 | + |
| 13 | +<script> |
| 14 | +import Vue from "vue"; |
| 15 | +import { AutoCompletePlugin } from "@syncfusion/ej2-vue-dropdowns"; |
| 16 | +Vue.use(AutoCompletePlugin); |
| 17 | +import { DataManager, WebApiAdaptor, |
| 18 | +Query } from '@syncfusion/ej2-data'; |
| 19 | +export default Vue.extend({ |
| 20 | + data: function() { |
| 21 | + return { |
| 22 | + // dataItem: [ |
| 23 | + // { Id: 'Game1', Game: 'Football' }, |
| 24 | + // { Id: 'Game2', Game: 'Basketball'}, |
| 25 | + // { Id: 'Game3', Game: 'Volleyball'}, |
| 26 | + // { Id: 'Game4', Game: 'Baseball' }, |
| 27 | + // { Id: 'Game5', Game: 'Badminton'}, |
| 28 | + // ], |
| 29 | + // dataFields: { value: 'Game' }, |
| 30 | + dataItem: new DataManager({ |
| 31 | + url: 'https://ej2services.syncfusion.com/production/web-services/api/Employees', |
| 32 | + adaptor: new WebApiAdaptor, |
| 33 | + crossDomain: true |
| 34 | + }), |
| 35 | + dataFields:{ value: 'FirstName' }, |
| 36 | + dataQuery: new Query().select(['FirstName', 'EmployeeID']).take(9).requiresCount(), |
| 37 | + |
| 38 | + }; |
| 39 | + } |
| 40 | +}); |
| 41 | +</script> |
| 42 | + |
| 43 | +<style> |
| 44 | +@import url(https://cdn.syncfusion.com/ej2/material.css); |
| 45 | +</style> |
0 commit comments