在表單里使用v-model綁定了一個(gè)對(duì)象,之前使用的時(shí)候都沒(méi)有出現(xiàn)過(guò)這種.
正常的應(yīng)該全部屬性打印出來(lái),現(xiàn)在雙向綁定全部失效了,下拉菜單全都選不上了;除非用單屬性,而不是放到一個(gè)對(duì)象上.
圖片描述
<template>
<div class="app-container">
<!--周期統(tǒng)計(jì)-->
<div class="count">
<div style="padding: 10px;">
<h2><span>周期統(tǒng)計(jì)</span><el-button @click="refUserCount()" size="small" type="primary">
<i class="iconfont icon-shuaxin" style="font-size:12px"></i>刷新</el-button></h2>
<ul v-if="userCount" class="Grid">
<li @click="$router.push({path:'/Operative/addday'})" style="cursor: pointer" class="Grid-cell Grid-cell.u-full">
<div>
<p><span>{{userCount.phoneRegTotal}}</span> / {{userCount.autoRegTotal}} / {{userCount.allTotal}}</p>
<h4><span>注冊(cè)用戶</span> / 分配賬號(hào) / 用戶總數(shù)</h4>
</div>
</li>
<li @click="$router.push({path:'/Operative/addday'})" style="cursor: pointer" class="Grid-cell Grid-cell.u-full">
<div>
<p><span>{{userCount.todayPhoneRegTotal}}</span> / {{userCount.todayAutoRegTotal}} / {{userCount.todayTotal}}</p>
<h4><span>今日新增注冊(cè)</span> / 今日新增分配 / 今日新增用戶總數(shù)</h4>
</div>
</li>
<li @click="$router.push({path:'/Operative/addday'})" style="cursor: pointer" class="Grid-cell Grid-cell.u-full">
<div>
<p><span>{{userCount.currentOnlineTotal}}</span> / {{userCount.totalOnlineTop}} / {{userCount.historyOnlineTop}}</p>
<h4><span>當(dāng)前在線人數(shù)</span> / 當(dāng)天最高 / 歷史最高</h4>
</div>
</li>
<li @click="$router.push({path:'/Operative/activeday'})" style="cursor: pointer" class="Grid-cell">
<div>
<p>{{userCount.todayActiveTotal}}</p>
<h4>今日活躍人數(shù)</h4>
</div>
</li>
</ul>
</div>
</div>
<!-- 篩選 -->
<div class="public_nav">
<jg-systematics-border title="篩選 / 搜索">
<div style="margin:10px 0">
<div class="warp">
<span>用戶類型<i class="iconfont icon-maohao1"></i></span>
<el-select v-model="filter.useAccount" clearable placeholder="用戶類型">
<el-option label="全部" value=""></el-option>
<el-option label="分配賬號(hào)" value="0"></el-option>
<el-option label="注冊(cè)賬號(hào)" value="1"></el-option>
</el-select>
</div>
<div class="warp">
<span>渠道<i class="iconfont icon-maohao1"></i></span><jg-version @parentDate="cutoverVersion"></jg-version>
</div>
<div class="warp">
<span>版本<i class="iconfont icon-maohao1"></i></span><jg-channel @parentDate="cutoverChannel"></jg-channel>
</div>
<div class="warp">
<span>用戶狀態(tài)<i class="iconfont icon-maohao1"></i></span>
<el-select v-model="filter.status" clearable placeholder="處理狀態(tài)">
<el-option label="全部" value=""></el-option>
<el-option label="正常" value="1"></el-option>
<el-option label="封號(hào)" value="0"></el-option>
</el-select>
</div>
<div class="warp">
<span>時(shí)間類型<i class="iconfont icon-maohao1"></i></span>
<el-select v-model="filter.dateType" clearable placeholder="時(shí)間類型">
<el-option label="全部" value=""></el-option>
<el-option label="登錄時(shí)間" value="login"></el-option>
<el-option label="注冊(cè)時(shí)間" value="register"></el-option>
</el-select>
<jg-date-picker @parentDate='getChildData' :filter='initDate'></jg-date-picker>
</div>
<div class="warp">
<el-button class="el-icon-search" @click="Inquire">篩選</el-button>
</div>
</div>
<div style="margin:10px 0">
<div class="warp">
<span>賬號(hào)搜索<i class="iconfont icon-maohao1"></i></span>
<el-input placeholder="請(qǐng)輸入內(nèi)容" v-model="filter.keyword" style="width: 350px">
<el-select v-model="filter.userType" slot="prepend" placeholder="請(qǐng)選擇" style="width: 160px">
<el-option label="賬號(hào)名" value="name"></el-option>
<el-option label="賬號(hào)名ID" value="id"></el-option>
<el-option label="賬號(hào)名UUID" value="uuid"></el-option>
</el-select>
</el-input>
</div>
<div class="warp">
<el-button class="el-icon-search" @click="Inquire">搜索</el-button>
</div>
</div>
</jg-systematics-border>
</div>
<!-- 表格 -->
<div>
<p style="text-align: left;margin-left: 5px">用戶列表:<span
style="font-size: 16px;color: red">{{pagination.total}}</span>條結(jié)果
</p>
<el-table
:data="tableData"
border
stripe
style="width: 100%">
<el-table-column prop="id" label="ID"></el-table-column>
<el-table-column prop="name" label="賬號(hào)"></el-table-column>
<el-table-column prop="uuid" label="UUID"></el-table-column>
<el-table-column prop="reg_time" label="注冊(cè)時(shí)間">
<template scope="scope">
{{scope.row.reg_time}}
</template>
</el-table-column>
<el-table-column label="注冊(cè)版本">
<template scope="scope">
{{scope.row.channel}}_{{scope.row.edition}}_{{scope.row.app_version}}
</template>
</el-table-column>
<el-table-column prop="last_login_time" label="登錄時(shí)間">
<template scope="scope">
{{scope.row.last_login_time}}
</template>
</el-table-column>
<el-table-column prop="app_channel" label="登錄版本"></el-table-column>
<el-table-column prop="expiration" label="到期時(shí)間"></el-table-column>
<el-table-column prop="total_amount" label="充值金額"></el-table-column>
<el-table-column prop="status" label="用戶狀態(tài)">
<template scope="scope">
<el-tag :type="scope.row.status === 1 ? 'success' : 'primary'"
close-transition>{{scope.row.status === 1 ? '正常' : '封號(hào)'}}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="date" label="詳情" width="80" fixed="right">
<template scope="scope">
<el-button size="small" @click="detail(scope.row)">詳情</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@current-change="handleCurrentChange"
:current-page="pagination.currentPage"
layout="total, prev, pager, next, jumper"
:page-size="pagination.pageSize"
:total="pagination.total"
class="page">
</el-pagination>
</div>
</div>
</template>
<script>
import { monthTimes } from '@/utils/index'
import * as API from 'api/userlist'
export default {
data() {
return {
userCount: {},
initDate: {
start: '',
end: ''
},
filter: {
useAccount: '',
status: '',
channel: '',
edition: '',
dateType: '',
startTime: '',
endTime: '',
userType: 'name',
keyword: ''
},
tableData: [],
pagination: {
pageSize: 15,
currentPage: 1,
total: 0
}
}
},
methods: {
refUserCount() {
this._getUserListAccountTotal()
},
getChildData(val) {
this.initDate = val
},
cutoverVersion(val) {
this.filter.edition = val
},
cutoverChannel(val) {
this.filter.channel = val
},
Inquire() {
this._getUserListAccountList()
},
handleCurrentChange(val) {
this.pagination.currentPage = val
this._getUserListAccountList()
},
detail(row) {
console.log(row)
},
_getUserListAccountTotal() {
API.fetchUserListAccountTotal().then(res => {
if (res.data.status === 'success') {
this.userCount = Object.assign({}, res.data.data)
}
})
},
_getUserListAccountList() {
if (!this.filter.keyword) {
this.filter.userType = ''
}
API.fetchUserListAccountList(this.filter).then(res => {
if (res.data.status === 'success') {
this.tableData = res.data.data.data
this.pagination.total = res.data.data.total
this.filter.userType = 'name'
}
})
}
},
mounted() {
console.log(this.filter)
this.initDate = monthTimes()
this._getUserListAccountTotal()
this._getUserListAccountList()
}
}
</script>
我在這里定義一個(gè)變量options,之前的的傳參是直接傳this.filter,現(xiàn)在傳options后就可以了,不知道為什么是這里的問(wèn)題
const options = Object.assign({}, this.filter)
API.fetchUserListAccountList(options).then(res => {
if (res.data.status === 'success') {
this.tableData = res.data.data.data
this.pagination.total = res.data.data.total
this.filter.userType = 'name'
}
})
北大青鳥(niǎo)APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國(guó)IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國(guó)家
北大青鳥(niǎo)中博軟件學(xué)院創(chuàng)立于2003年,作為華東區(qū)著名互聯(lián)網(wǎng)學(xué)院和江蘇省首批服務(wù)外包人才培訓(xùn)基地,中博成功培育了近30000名軟件工程師走向高薪崗位,合作企業(yè)超4
中公教育集團(tuán)創(chuàng)建于1999年,經(jīng)過(guò)二十年潛心發(fā)展,已由一家北大畢業(yè)生自主創(chuàng)業(yè)的信息技術(shù)與教育服務(wù)機(jī)構(gòu),發(fā)展為教育服務(wù)業(yè)的綜合性企業(yè)集團(tuán),成為集合面授教學(xué)培訓(xùn)、網(wǎng)
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國(guó)一站式人才培養(yǎng)平臺(tái)、一站式人才輸送平臺(tái)。2014年4月3日在美國(guó)成功上市,融資1
浪潮集團(tuán)項(xiàng)目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺(tái)面向?qū)ο箝_(kāi)發(fā)經(jīng)驗(yàn),技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點(diǎn)難點(diǎn)突出、引人入勝。
曾工作于聯(lián)想擔(dān)任系統(tǒng)開(kāi)發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項(xiàng)目經(jīng)理從事移動(dòng)互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
精通HTML5和CSS3;Javascript及主流js庫(kù),具有快速界面開(kāi)發(fā)的能力,對(duì)瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁(yè)制作和網(wǎng)頁(yè)游戲開(kāi)發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開(kāi)發(fā)經(jīng)驗(yàn)。曾經(jīng)歷任德國(guó)Software AG 技術(shù)顧問(wèn),美國(guó)Dachieve 系統(tǒng)架構(gòu)師,美國(guó)AngelEngineers Inc. 系統(tǒng)架構(gòu)師。