1 npm i element-ui -S
2 在main.js中
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);
在项目中
import ElementUI from ‘element-ui’;
import ‘element-ui/lib/theme-chalk/index.css’;
Vue.use(ElementUI);
然后在所需要的项目中加入搜索框
<el-autocomplete
style="width:100%;"
popper-class="autoAddressClass"
v-model="form.address"
:fetch-suggestions="querySearchAsync"
:trigger-on-focus="false"
placeholder="详细地址"
@select="handleSelect"
clearable>
<template slot-scope="{ item }">
<i class="el-icon-search fl mgr10"></i>
<div style="overflow:hidden;">
<div class="title">{
{ item.title }}</div>
<span class="address ellipsis">{
{