index.vue 2.3 KB
Newer Older
P
Pan 已提交
1 2 3 4 5
<template>
  <div class="app-container">
    <el-card class="box-card">
      <div slot="header">
        <span style="line-height: 36px;">偏好设置</span>
P
Pan 已提交
6
        <a class='link-type link-title' target="_blank" href='https://segmentfault.com/a/1190000009762198#articleHeader2'>态换肤的教程</a>
P
Pan 已提交
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
      </div>
      <div class="box-item">
        <span class="field-label">换肤:</span>
        <el-switch v-model="theme" on-text="" off-text="">
        </el-switch>
      </div>
    </el-card>

    <div class="block">
      <span class="demonstration">Button: </span>
      <span class="wrapper">
        <el-button type="success">成功按钮</el-button>
        <el-button type="warning">警告按钮</el-button>
        <el-button type="danger">危险按钮</el-button>
        <el-button type="info">信息按钮</el-button>
       </span>
    </div>

    <div class="block">
P
refine  
Pan 已提交
26
      <el-tag class='tag-item' v-for="tag in tags" :type="tag.type" :key='tag.type'>
P
Pan 已提交
27 28 29 30 31
        {{tag.name}}
      </el-tag>
    </div>

    <div class="block">
P
refine  
Pan 已提交
32
      <el-alert class='alert-item' title="成功提示的文案" type="success">
P
Pan 已提交
33
      </el-alert>
P
refine  
Pan 已提交
34
      <el-alert class='alert-item' title="消息提示的文案" type="info">
P
Pan 已提交
35
      </el-alert>
P
refine  
Pan 已提交
36
      <el-alert class='alert-item' title="警告提示的文案" type="warning">
P
Pan 已提交
37
      </el-alert>
P
refine  
Pan 已提交
38
      <el-alert class='alert-item' title="错误提示的文案" type="error">
P
Pan 已提交
39 40 41 42 43 44
      </el-alert>
    </div>

  </div>
</template>

P
Pan 已提交
45

P
Pan 已提交
46
<script>
P
Pan 已提交
47 48
import { toggleClass } from 'utils'
import '@/assets/custom-theme/index.css' // 换肤版本element-ui css
P
Pan 已提交
49

P
Pan 已提交
50 51 52 53
export default {
  data() {
    return {
      theme: false,
P
Pan 已提交
54 55 56 57 58 59 60 61
      tags: [
        { name: '标签一', type: '' },
        { name: '标签二', type: 'gray' },
        { name: '标签三', type: 'primary' },
        { name: '标签四', type: 'success' },
        { name: '标签五', type: 'warning' },
        { name: '标签六', type: 'danger' }
      ]
P
Pan 已提交
62 63 64 65 66
    }
  },
  watch: {
    theme() {
      toggleClass(document.body, 'custom-theme')
P
Pan 已提交
67
    }
P
Pan 已提交
68 69
  }
}
P
Pan 已提交
70 71 72
</script>

<style scoped>
P
Pan 已提交
73 74 75 76 77 78 79 80 81 82 83 84 85
  .box-card{
    width: 400px;
    margin: 20px auto;
  }
  .block{
    padding: 30px 24px;
  }
  .alert-item{
    margin-bottom: 10px;
  }
  .tag-item{
    margin-right: 15px;
  }
P
Pan 已提交
86 87 88
  .link-title{
    margin-left:35px;
  }
P
Pan 已提交
89
</style>