操作记录
描述:
技术杖element组件封装的
<template> <div :class="onOff ? 'content contentLeft' : 'content'"> <div :class="onOff ? 'record' : 'packUp'" class="btn" @click=" () => { onOff = !onOff; } " > {{ onOff ? "操作记录" : "收起" }} </div> <div class="body"> <h3>操作记录</h3> <el-timeline :reverse="reverse"> <el-timeline-item v-for="(activity, index) in activities" :key="index" :timestamp="activity.timestamp" > {{ activity.content }} </el-timeline-item> </el-timeline> </div> </div></template><script>export default { props: { activities: { type: Array, default: function () { return [ { content: "测试数据1", timestamp: "2018-04-15", }, { content: "测试数据2", timestamp: "2018-04-13", }, { content: "测试数据3", timestamp: "2018-04-11", }, ]; }, }, reverse: { type: Boolean, default: false, }, }, data() { return { // 开关 onOff: true, }; },};</script><style scoped lang="scss">.content { display: flex; position: fixed; top: 20%; right: -20px; z-index: 333; transition: right 1s; .record { font-size: 14px; box-sizing: border-box; height: 80px; width: 50px; line-height: 50px; color: #fff; background-color: #1bb6ec; border-radius: 6px 0 0 6px; cursor: pointer; -ms-writing-mode: tb-rl; text-align: center; writing-mode: tb-rl; &::selection { text-shadow: none; } } .packUp { font-size: 14px; box-sizing: border-box; height: 80px; width: 50px; border: 1px solid #ccc; line-height: 50px; background-color: #fff; border-radius: 6px 0 0 6px; cursor: pointer; writing-mode: tb-rl; -ms-writing-mode: tb-rl; text-align: center; &::selection { text-shadow: none; } } .body { width: 260px; height: 360px; padding: 10px; box-sizing: border-box; border: 1px solid #ccc; background-color: #fff; overflow: auto; h3 { text-align: center; margin-bottom: 20px; } }}.contentLeft { right: -280px; transition: right 1s;}</style>

