原文:https://www.jianshu.com/p/1704b5935a8
【時間選擇器】
Element UI手冊:https://cloud.tencent.com/developer/doc/1270
中文文檔:http://element-cn.eleme.io/#/zh-CN
github地址:https://github.com/ElemeFE/element
前一篇已經安裝好了Element UI環境,現在開始來實際操作框架提供的一些組件的運用了。
在准備好以下文章里面的內容之后,可以打開test.vue文件,開始寫代碼了。Vue框架Element UI教程-安裝環境搭建(一)https://www.jianshu.com/p/ab3c34a95128
打開test.vue文件,開始寫代碼
<template> <div> <el-time-picker is-range v-model="value" range-separator="-" start-placeholder="開始時間" end-placeholder="結束時間" placeholder="選擇時間范圍"> </el-time-picker> </div> </template> <script> export default { data() { return { value: [new Date(2016, 9, 10, 8, 40), new Date(2016, 9, 10, 9, 40)], }; } } </script>
npm run dev 運行,瀏覽器顯示如下,實現了一個簡單的時間選擇器

出現和隱藏動畫
Vue框架Element UI教程-安裝環境搭建(一)https://www.jianshu.com/p/ab3c34a95128
今天繼續寫組件的運用相關例子
點擊按鈕的時候,元素會呈現一個出現和隱藏的動畫功能。
<template> <div> <el-button @click="show = !show">點擊按鈕</el-button> <div style="display: flex; margin-top: 20px; height: 100px;"> <transition name="el-fade-in-linear"> <div v-show="show" class="transition-box">我會消失在人海之中</div> </transition> </div> </div> </template> <script> export default { data: () => ({ show: true }) } </script> <style> .transition-box { margin-bottom: 10px; width: 300px; height: 100px; border-radius: 4px; background-color: #42B983; text-align: center; color: #fff; padding: 40px 20px; box-sizing: border-box; margin-left: 520px; } </style>
效果大家可以自行嘗試。

左側導航欄
Vue框架Element UI教程-安裝環境搭建(一)https://www.jianshu.com/p/ab3c34a95128
在用Element UI框架的時候
<template> <div> <el-row class="tac"> <el-col :span="4"> <el-menu default-active="2" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b"> <el-submenu index="1"> <template slot="title"> <i class="el-icon-s-platform"></i> <span>服務大廳</span> </template> <el-menu-item-group> <el-menu-item index="1-1">在場服務</el-menu-item> <el-menu-item index="1-2">歷史服務</el-menu-item> </el-menu-item-group> </el-submenu> <el-submenu index="2"> <template slot="title"> <i class="el-icon-s-tools"></i> <span>系統設置</span> </template> <el-menu-item-group> <el-menu-item index="1-1">權限管理</el-menu-item> <el-menu-item index="1-2">角色管理</el-menu-item> </el-menu-item-group> </el-submenu> <el-submenu index="3"> <template slot="title