父組件處理:
<template> <div class="wrap"> <!-- 搜索框 --> <div class="searchInputArea"> <div class="searchBarBox"> <div class="inputWrap" > <form onsubmit="JavaScript:return false" action> <input :placeholder = "placeholderStr" type="search" ref = "input" v-model="keyword" /> <span class="clearBtn" v-show="keyword" @click="clear"></span> </form> </div> </div> </div> <div class="myFastChoiceBlock" v-show="!keyword"> <!-- 最近伙伴和我的關注 --> <fast-choice :successInvite="successInvite" @invite="inviteClick"></fast-choice> </div> <div class="searchContainer"> <search-content :searchName="keyword" :successInvite="successInvite" @inviteClick="inviteClick" v-if="keyword !== ''"></search-content> </div> <!-- 協議彈出層 --> <pop-up @change="closeLayer" v-if="popuShow"> <h2 class="title">{{protocolTitle}}</h2> <div class="content" v-html="protocolCon"></div> <div class="confirmBtn" :class="{active:isActive}" @click="confirmProtocol">{{btntxt}}</div> <div class="popCloseCon" @click="closeActionClick"></div> </pop-up> <!-- 比例彈出層 --> <scale @change="closeScale" @send="sendAjaxClick" :number="scaleCount" :scaleBtn="scaleBtn" :scaleDesc="scaleDesc" v-show="isScale" :userId="userId"></scale> </div> </template> <script> import FastChoice from './components/fastChoice'; import PopUp from './components/PopUp'; import scale from './components/scale'; import SearchContent from './components/searchContent'; const pageSize=10; let t=''; export default { name: "Search", data() { return { placeholderStr: '搜一搜你想找的TA', keyword: '', list: [], timerKey: null, dataList:[],//列表數據 totalPage:1, popuShow:false,//協議彈出層 isScale:false,//比例彈出層 scaleValue:'',//分成比例 userId:'', isActive:true,//操作協議按鈕灰色顯示 sencond:5,//秒數 btntxt:'', //操作協議層按鈕文字顯示 scaleValue:'',//分成比例 scaleDesc:'',//比例彈窗描述 scaleBtn:'', scaleCount:'50%',//默認分成比例 successInvite: [],//默認未邀請 protocolTitle:'',//協議標題 protocolCon:'' //協議內容 }; }, components:{FastChoice,PopUp,scale, SearchContent}, watch: { keyword () { if (!this.keyword){ return; } } }, mounted() { this.protocolAjax(); }, methods: { //邀請 inviteClick (item) { //點擊邀請過的不予操作 if(this.successInvite.indexOf(item.hwUserId) > -1 || item.inviteStatus){ return; } this.isScale = true; this.userId = item.hwUserId; this.scaleDesc = '邀請成功后你可獲取該用戶部分收益,選擇雙方都認可的分成比例可以提高邀請成功率哦~'; this.scaleBtn = '發送邀請'; this.scaleCount = '50%';//邀請比例統一為50% }, //點擊發送邀請 sendAjaxClick (value){ this.scaleValue = value; this.popuShow = true; this.isScale = false; this.isActive =