<template>
<card>
<el-popover
placement="right"
width="400"
trigger="click"
>
<el-table
ref="singleTable"
:data="pinyinOptions"
highlight-current-row
style="width: 100%"
@current-change="handleCurrentChange"
>
<el-table-column
type="index"
width="50"
/>
<el-table-column
property="date"
label="日期"
width="120"
/>
<el-table-column
property="name"
label="姓名"
width="120"
/>
<el-table-column
property="address"
label="地址"
/>
</el-table>
<!-- <div style="margin-top: 20px">
<el-button @click="setCurrent(tableData[1])">选中第二行</el-button>
<el-button @click="setCurrent()">取消选择</el-button>
</div> -->
<el-input
slot="reference"
v-model="input"
style="width:400px"
@input="PinyinMatch"
@keyup.enter.native="sel"
/>
</el-popover>
</card>
</template>
<script>
export default {
data() {
return {
tableData: [{
date: '2016-05-02',
name: '张三',
address: '上海'
}, {
date: '2016-05-04',
name: '赵小虎',
address: '石家庄'
}, {
date: '2016-05-01',
name: '李四',
address: '保定'
}, {
date: '2016-05-03',
name: '赵六',
address: '唐山'
}],
currentRow: null,
input: '',
pinyinOptions: []
}
},
created() {
this.pinyinOptions = this.tableData
},
methods: {
setCurrent(row) {
this.$refs.singleTable.setCurrentRow(row)
},
handleCurrentChange(val) {
this.currentRow = val
if (val !== undefined) {
this.input = val.name
} else {
this.input = ''
}
},
PinyinMatch(val) {
const PinyinEngine = require('pinyin-engine')
// 建立数据索引
const pinyinEngine = new PinyinEngine(this.tableData, ['name'])
// 查询
const pinyinVal = pinyinEngine.query(val)
this.pinyinOptions = pinyinVal
},
sel() {
this.input = this.pinyinOptions[0].name
}
}
}
</script>

el-popover 点击input框出现table表,可点击选中,可拼音检索完回车选中的更多相关文章

  1. 当鼠标点击input框时,想让全选input框的所有内容只需要加“onfocus="this.select();”就可以了

    当鼠标点击input框时,想让全选input框的所有内容只需要加“onfocus="this.select();”就可以了

  2. 鼠标点击input框后里面的内容就消失

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  3. 关于点击input框唤醒键盘导致input被遮盖的问题

    关于点击input框唤醒键盘导致input被遮盖的问题 这个问题相信大家在实际开发过程当中都有遇见,我自己也遇见过很多次.之前在百度上看见大多数的方法利用的都是键盘唤醒了之后,页面的实际高度会发生变化 ...

  4. 点击Input框弹出日期选项

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  5. 写个点击input框 下方弹出月份时间等

    <input type="text" name="test" id="test" value="" "& ...

  6. 点击input框,不让手机软键盘弹出的办法

    设置readonly="" <input type="text" readonly="" placeholder="请输入邮 ...

  7. js实现鼠标点击input框后里面的内容就消失代码

    <!--# <a href="http://www.mianfeimoban.com/texiao_mb/" target="_blank" cla ...

  8. 手机端上点击input框软键盘出现时把input框不被覆盖,显示在屏幕中间(转)

    转载地址:https://www.cnblogs.com/xzzzys/p/7526761.html 1  用定位为题来解决var oHeight = $(document).height(); // ...

  9. 在手机上点击input框时会放大页面

    加上  <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-s ...

随机推荐

  1. Selenium实战(四)——unittest单元测试框架1

    Python中的单元测试框架包含:doctest.unittest.pyttest.nose等,使用unittest单元测试框架不需要自行定义断言失败的提示,并且当一个测试函数执行失败后,后面的测试函 ...

  2. layui弹出表单提交后,界面model验证部分起作用

    情况1----input属性中type=submit时验证都可以起作用,但是弹出层表单的返回值不能获取,所以用ajax二次提交后会出现重复添加数据的问题 情况2----input属性中type=but ...

  3. 解决kbmMW Scheduler在任务中停止任务遇到的问题

    procedure TCustomGridViewCameraDoc.InitSchedule; begin Scheduler.Schedule( procedure(const ASchedule ...

  4. Mac下git的安装配置以及gerrit初次使用

    1.Mac下git下载 在终端首次运行git命令,若未安装,会提示下载开发者工具Xcode,根据提示下载即可: 2.查看git版本 git version 2.首次使用git配置 git config ...

  5. ClosedXML、DocumentFormat.OpenXml导出DataTable到Excel

    在很多系统中都用到导出,使用过多种导出方式,觉得ClosedXML插件的导出简单又方便. 并且ClosedXML.DocumentFormat.OpenXml都是MIT开源. 首先通过 Nuget 安 ...

  6. Android列表类视图之基本适配器BaseAdapter

    说到列表视图,不难联想到前面提到过的数组适配器,但是数组适配器只能搭建文本选择项,扩展能力并不强,Android提供了一种适应性更强的基本适配器BaseAdapter,该适配器允许开发者在别的代码中进 ...

  7. Java课后总结-原码、补码、反码

    1.原码.补码.反码的定义和表示方法. 数在计算机中是以二进制形式表示的. 数分为有符号数和无符号数. 原码.反码.补码都是有符号定点数的表示方法. 一个有符号定点数的最高位为符号位,0是正,1是副. ...

  8. vs2008 asp.net “无法连接到ASP.NET Development server”

    这是因为该网站启动ASP.NET Development server时使用的端口被占用而导致的. 解决方法: 1.在“解决方案资源管理器”中选中网站项目名称,然后切换到“属性”窗口 2.在“属性”窗 ...

  9. Java多线程之synchronized和volatile

    概述 用Java来开发多线程程序变得越来越常见,虽然Java提供了并发包来简化多线程程序的编写,但是我们有必要深入研究一下,才能更好的掌握这块知识. 本文主要对Java提供的底层原语synchroni ...

  10. 你写的 Python 代码总是不规范?用它!

    今天咱们来说说 代码风格 ! 不同的编程语言 有不同的代码风格 ​ ​ ​ ​ ​ Python 的代码规范 就是人们常说的 PEP8 ​ ​ 在这个网站 https://www.python.org ...