vue安装element-ui并使用

本文介绍了如何在Vue项目中安装和使用Element-UI库,通过`npm i element-ui -S`进行安装,并在main.js中引入。接着展示了在组件中使用Element-UI的搜索框,并提供了搜索事件的实现,包括创建百度地图的全局变量。同时提到了对下拉框样式的调整方法。
摘要由CSDN通过智能技术生成

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">{
  {
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值