Vue render渲染時(shí)間戳轉(zhuǎn)時(shí)間,時(shí)間轉(zhuǎn)時(shí)間戳及渲染進(jìn)度條效果
一.格式化時(shí)間
效果圖:

實(shí)現(xiàn)上述界面代碼如下:
data() {
return {
loading: false,
demandData: [],
demandcount: 0,//總條數(shù)
skip: 0, //分頁
pageSize: this.LIMIT,
columns: [
{
title: '編號(hào)',
width: 60,
align: 'center',
type: 'index'
},
{
title: '標(biāo)簽名稱',
key: 'd_title'
},
{
title: '創(chuàng)建者',
key: 'd_create_user'
},
{
title: '內(nèi)容描述',
key: 'd_content',
width: "20%"
},
{
title: '創(chuàng)建時(shí)間',
key: 'd_create_time',
render: (h, params) => {
const row = params.row;
return h('div', [
h('span', {}, this.timeStamp(row.d_create_time)),
]);
}
},
{
title: '修改時(shí)間',
key: 'd_change_times'
},
{
title: '完成進(jìn)度',
key: 'd_progress',
render: (h, params) => {
return h('div',[
h('Progress', {
props: {
type: 'Progress',
size: 'small',
percent:parseInt(params.row.d_progress)
}
}, params.row.d_progress+'%'),])
}
},
{
title: '操作',
key: 'operation',
align: 'center',
render: (h, params) => {
return h('div', [
h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '5px'
},
on: {
click: () => {
console.log(params);
// this.$router.push({path: '/xxxx', query: {fc_id: params.row.fc_id}});
alert(1)
}
}
}, '分配'),
h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '5px'
},
on: {
click: () => {
console.log(params);
alert(2)
}
}
}, '編輯'),
h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '5px'
},
on: {
click: () => {
console.log(params);
// this.$router.push({path: '/xxxx', query: {fc_id: params.row.fc_id}});
alert(3)
}
}
}, '備注'),
h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '0px'
},
on: {
click: () => {
console.log(params);
// this.$router.push({path: '/xxxx', query: {fc_id: params.row.fc_id}});
alert(4)
}
}
}, '修改')
]);
}
}
]
}
},
數(shù)據(jù)表:

顯示時(shí)間具體代碼:
{
title: '創(chuàng)建時(shí)間',
key: 'd_create_time',
render: (h, params) => {
const row = params.row;
return h('div', [
h('span', {}, this.timeStamp(row.d_create_time)),
]);
}
}
時(shí)間轉(zhuǎn)化工具類:
//時(shí)間戳轉(zhuǎn)時(shí)間
Vue.prototype.timeStamp = function (time) {
var date = new Date(time * 1000);
var Y = date.getFullYear() + '-';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var D = date.getDate() + ' ';
var h = date.getHours() + ':';
var m = date.getMinutes() + ':';
var s = date.getSeconds();
if(D < 10){
D = "0" + D;
}
return Y + M + D
}
//時(shí)間轉(zhuǎn)時(shí)間戳
Vue.prototype.time = function (index) {
var strtime = index;
var date = new Date(strtime);
var time = Date.parse(date) / 1000;
return time
}
二.進(jìn)度條:
{
title: '完成進(jìn)度',
key: 'd_progress',
render: (h, params) => {
return h('div',[
h('Progress', {
props: {
type: 'Progress',
size: 'small',
percent:parseInt(params.row.d_progress)
}
}, params.row.d_progress+'%'),])
}
}
其他具體界面實(shí)現(xiàn)請(qǐng)查看:https://www.iviewui.com/components/table
總結(jié)
以上所述是小編給大家介紹的Vue render渲染時(shí)間戳轉(zhuǎn)時(shí)間,時(shí)間轉(zhuǎn)時(shí)間戳及渲染進(jìn)度條效果,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
- Vue進(jìn)度條progressbar組件功能
- vue組件實(shí)現(xiàn)進(jìn)度條效果
- vue頁面加載時(shí)的進(jìn)度條功能(實(shí)例代碼)
- vue實(shí)現(xiàn)簡(jiǎn)單loading進(jìn)度條
- vue.js+ElementUI實(shí)現(xiàn)進(jìn)度條提示密碼強(qiáng)度效果
- 在vue項(xiàng)目中使用Nprogress.js進(jìn)度條的方法
- vue開發(fā)拖拽進(jìn)度條滑動(dòng)組件
- vue2.0實(shí)現(xiàn)音樂/視頻播放進(jìn)度條組件
- Vue實(shí)現(xiàn)帶進(jìn)度條的文件拖動(dòng)上傳功能
- vue視頻時(shí)間進(jìn)度條組件使用方法詳解
相關(guān)文章
最適應(yīng)的vue.js的form提交涉及多種插件【推薦】
這篇文章主要介紹了最適應(yīng)的vue.js的form提交涉及多種插件,涉及到 vue.js動(dòng)態(tài)添加css樣式 ,tab切換 ,touch,表單提交,驗(yàn)證,toast,數(shù)據(jù)雙向綁定等。需要的朋友可以參考下2018-08-08
VUE 動(dòng)態(tài)組件的應(yīng)用案例分析
這篇文章主要介紹了VUE 動(dòng)態(tài)組件的應(yīng)用,結(jié)合具體案例形式分析了vue.js動(dòng)態(tài)組件的應(yīng)用場(chǎng)景、解決方案及相關(guān)操作技巧,需要的朋友可以參考下2019-12-12
vue實(shí)現(xiàn)一個(gè)滾動(dòng)條樣式
滾動(dòng)條能夠給用戶帶來極好的體驗(yàn)效果,今天通過本文給大家分享vue實(shí)現(xiàn)一個(gè)滾動(dòng)條樣式,代碼簡(jiǎn)單易懂,需要的朋友參考下吧2021-07-07
vue elementui 實(shí)現(xiàn)搜索欄公共組件封裝的實(shí)例代碼
這篇文章主要介紹了vue elementui 搜索欄公共組件封裝,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-01-01

