vue中關(guān)于el-popover的使用
關(guān)于el-popover的使用
trigger屬性用于設(shè)置何時(shí)觸發(fā) Popover,支持四種觸發(fā)方式:hover,click,focus 和 manual。
對(duì)于觸發(fā) Popover 的元素,有兩種寫法:使用 slot="reference" 的具名插槽,或使用自定義指令v-popover指向 Popover 的索引ref。
<template>
<div class="listcontent">
<el-row v-for="(item,index) in datalist" :key="index">
<el-popover
placement="right"
trigger="hover"
>
<div class="popup" >
<h3>{{item.industryName}}</h3>
<el-row v-for="(zxSysIndustryChildren,cindex) in item.zxSysIndustryChildren" :key="cindex" style="width:600px;">
<el-col :span="6" style="color:#000000;font-size:13px">
{{zxSysIndustryChildren.occupationName}}
</el-col>
<el-col :span="18" style="border-bottom: 1px solid #F4F4F4;" >
<el-radio-group v-model="radio" v-for="(zxSysPositionChildren,tindex) in zxSysIndustryChildren.zxSysPositionChildren" :key="tindex">
<el-radio-button>{{zxSysPositionChildren.positionName}}</el-radio-button>
</el-radio-group>
</el-col>
</el-row>
</div>
<el-button type="primary" plain slot="reference" style="text-align:left;">
<b>{{item.industryName}}</b>
<span class="textname" v-for="(zxSysPositionArrayHot,cindex) in item.zxSysPositionArrayHot" :key="cindex">{{zxSysPositionArrayHot.positionName}}</span>
</el-button>
</el-popover>
</el-row>
<div class="checkmore">
<el-button type="text" plain>
顯示全部職位
</el-button>
</div>
</div>
</template>
<script>
export default {
data() {
return {
radio:'',
datalist:[],
datalist1:[],
companynum:7,
};
},
mounted() {
this.queryZxSysIndustryTree();
},
methods: {
loadmoreCompany(){
if(this.datalist1.length>=this.companynum){
this.datalist = this.datalist1.slice(0,this.companynum);
}
},
handleSelect(key, keyPath) {
this.queryZxSysIndustryTree();
},
queryZxSysIndustryTree(){
//三級(jí)聯(lián)查
this.$busapi.zxSysIndustry.zxSysIndustryTree().then((res) => {
if (res.code == "0000") {
this.datalist1 = res.data
this.datalist = res.data.slice(0,this.companynum);
} else {
this.$message({message: '錯(cuò)誤原因:' + res.msg, type: 'error'})
}
}).catch((res) => {
this.$message({message: res.msg, type: 'error'});
});
},
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped="scoped">
.listcontent{
::v-deep.el-popover__reference-wrapper{
color: red;
border-radius: 5px;
.el-button--primary.is-plain{
width: 100%;
height: 48px;
color: #515151;
border-radius: 0px;
border: 0rem;
background-color: #fff;
b{
font-size: 16px;
color: #000000;
}
span.textname{
font-size: 14px;
display: inline-block;
margin-left: 20px;
}
}
.el-button--primary.is-plain:active, .el-button.is-plain:focus, .el-button.is-plain:hover{
color: #fff;
background-color: $frontNormalColor;
b{
color: #fff;
}
}
}
.checkmore{
background-color: #fff;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
border-top: 1px solid #E4E4E4;
.el-button{
margin-left: 20px;
height: 48px;
font-size: 16px;
}
}
}
.el-popover{
color: red;
h3{
// margin-bottom: 15px;
}
.popup{
line-height: 2.4375rem;
::v-deep.el-radio-button__inner{
border: 0px;
padding: 12px 16px;
}
::v-deep.el-radio-button:first-child .el-radio-button__inner{
border-radius: 0px;
}
::v-deep.el-radio-button:last-child .el-radio-button__inner{
border-radius: 0px;
}
}
}
</style>vue點(diǎn)擊關(guān)閉el-popover
<el-popover ref="popover"
placement="bottom" trigger="click" >
<div>
<el-form style="margin-left: 30px;" label-width="90px" size="small" :model="formInline">
<el-form-item label="數(shù)據(jù)名稱:">
<el-input v-model="formInline.text"></el-input>
</el-form-item>
<el-form-item label="創(chuàng)建人:">
<el-input v-model="formInline.creator"></el-input>
</el-form-item>
<el-form-item label="數(shù)據(jù)類型:">
<el-select v-model="formInline.type" placeholder="請(qǐng)選擇">
<el-option label="請(qǐng)選擇" value />
<el-option v-for="types in dataTypes" :key="types.id" :value="types.code" v-text="types.name" :label="types.name"/>
</el-select>
</el-form-item>
<el-form-item label="創(chuàng)建時(shí)間:">
<el-date-picker
v-model="formInline.timerange"
type="daterange"
range-separator="至"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="開始日期"
end-placeholder="結(jié)束日期"
></el-date-picker>
</el-form-item>
</el-form>
<span slot="footer" style="float: right" >
<el-button @click="cancel()">取 消</el-button>
<el-button @click="resetQuery()">重 置</el-button>
<el-button @click="search()" style="background-color: #4C74E0;color: white">查 詢</el-button>
</span>
</div>
<el-button slot="reference" icon="el-icon-search" style="background-color:#656D92;color: white;margin-left: 20px" size="middle" >高級(jí)查詢</el-button>
</el-popover>方法里面:
? ? ? ? ? ? /*取消*/
? ? ? ? ? ? cancel(){
? ? ? ? ? ? ? ? this.$refs.popover.showPopper = false;
? ? ? ? ? ? }總結(jié)
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
Vue學(xué)習(xí)筆記進(jìn)階篇之過(guò)渡狀態(tài)詳解
本篇文章主要介紹了Vue學(xué)習(xí)筆記進(jìn)階篇之過(guò)渡狀態(tài)詳解,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-07-07
一篇看懂vuejs的狀態(tài)管理神器 vuex狀態(tài)管理模式
一篇看懂vuejs的狀態(tài)管理神器,Vuex一個(gè)專為Vue.js應(yīng)用程序開發(fā)的狀態(tài)管理模式,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-04-04
vue實(shí)現(xiàn)微信分享朋友圈,發(fā)送朋友的示例講解
下面小編就為大家分享一篇vue實(shí)現(xiàn)微信分享朋友圈,發(fā)送朋友的示例講解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-02-02
如何在Vue3中實(shí)現(xiàn)文件上傳功能結(jié)合后端API
文件上傳的功能實(shí)現(xiàn)是我們做Web應(yīng)用時(shí)候最為常見的應(yīng)用場(chǎng)景,下面這篇文章主要給大家介紹了關(guān)于如何在Vue3中實(shí)現(xiàn)文件上傳功能結(jié)合后端API的相關(guān)資料,文中通過(guò)代碼介紹的非常詳細(xì),需要的朋友可以參考下2024-09-09
在vue中多次調(diào)用同一個(gè)定義全局變量的實(shí)例
今天小編就為大家分享一篇在vue中多次調(diào)用同一個(gè)定義全局變量的實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-09-09
淺析webpack-bundle-analyzer在vue-cli3中的使用
這篇文章主要介紹了webpack-bundle-analyzer在vue-cli3中的使用,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2019-10-10
使用vue-router設(shè)置每個(gè)頁(yè)面的title方法
下面小編就為大家分享一篇使用vue-router設(shè)置每個(gè)頁(yè)面的title方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-02-02

