support Tag

support Tag
This commit is contained in:
梁灏 2017-03-02 12:22:15 +08:00
parent 15368be172
commit 456daf3492
6 changed files with 50 additions and 50 deletions

View file

@ -44,7 +44,7 @@
- [x] Badge - [x] Badge
- [ ] Collapse - [ ] Collapse
- [x] Timeline - [x] Timeline
- [ ] Tag - [x] Tag
- [ ] Tooltip - [ ] Tooltip
- [ ] Poptip - [ ] Poptip
- [ ] Carousel - [ ] Carousel

View file

@ -1,7 +1,9 @@
<template> <template>
<div :class="classes" transition="fade"> <transition name="fade">
<span :class="dotClasses" v-if="showDot"></span><span :class="textClasses"><slot></slot></span><Icon v-if="closable" type="ios-close-empty" @click.stop="close"></Icon> <div :class="classes">
</div> <span :class="dotClasses" v-if="showDot"></span><span :class="textClasses"><slot></slot></span><Icon v-if="closable" type="ios-close-empty" @click.native.stop="close"></Icon>
</div>
</transition>
</template> </template>
<script> <script>
import Icon from '../icon'; import Icon from '../icon';

View file

@ -35,7 +35,7 @@ import Steps from './components/steps';
import Switch from './components/switch'; import Switch from './components/switch';
// import Table from './components/table'; // import Table from './components/table';
// import Tabs from './components/tabs'; // import Tabs from './components/tabs';
// import Tag from './components/tag'; import Tag from './components/tag';
import Timeline from './components/timeline'; import Timeline from './components/timeline';
// import TimePicker from './components/time-picker'; // import TimePicker from './components/time-picker';
// import Tooltip from './components/tooltip'; // import Tooltip from './components/tooltip';
@ -102,7 +102,7 @@ const iview = {
// iTable: Table, // iTable: Table,
// Tabs: Tabs, // Tabs: Tabs,
// TabPane: Tabs.Pane, // TabPane: Tabs.Pane,
// Tag, Tag,
Timeline, Timeline,
TimelineItem: Timeline.Item, TimelineItem: Timeline.Item,
// TimePicker, // TimePicker,

View file

@ -24,6 +24,7 @@ li + li { border-left: solid 1px #bbb; padding-left: 10px; margin-left: 10px; }
<li><router-link to="/switch">Switch</router-link></li> <li><router-link to="/switch">Switch</router-link></li>
<li><router-link to="/alert">Alert</router-link></li> <li><router-link to="/alert">Alert</router-link></li>
<li><router-link to="/badge">Badge</router-link></li> <li><router-link to="/badge">Badge</router-link></li>
<li><router-link to="/tag">Tag</router-link></li>
</ul> </ul>
</nav> </nav>
<router-view></router-view> <router-view></router-view>

View file

@ -60,6 +60,10 @@ const router = new VueRouter({
{ {
path: '/badge', path: '/badge',
component: require('./routers/badge.vue') component: require('./routers/badge.vue')
},
{
path: '/tag',
component: require('./routers/tag.vue')
} }
] ]
}); });

View file

@ -1,47 +1,38 @@
<template> <template>
<Tag>标签一</Tag> <div>
<Tag>标签二</Tag> <Tag>标签一</Tag>
<Tag closable>标签三</Tag> <Tag>标签二</Tag>
<Tag closable color="blue">标签一</Tag> <Tag closable>标签三</Tag>
<Tag closable color="green">标签二</Tag> <Tag closable color="blue">标签一</Tag>
<Tag closable color="red">标签三</Tag> <Tag closable color="green">标签二</Tag>
<Tag closable color="yellow">标签四</Tag> <Tag closable color="red">标签三</Tag>
<br><br> <Tag closable color="yellow">标签四</Tag>
<Tag type="dot">标签一</Tag> <br><br>
<Tag type="dot" closable>标签一</Tag> <Tag type="dot">标签一</Tag>
<Tag type="dot" color="blue">标签一</Tag> <Tag type="dot" closable>标签一</Tag>
<Tag type="dot" color="blue" closable>标签一</Tag> <Tag type="dot" color="blue">标签一</Tag>
<Tag type="dot" color="green">标签一</Tag> <Tag type="dot" color="blue" closable>标签一</Tag>
<Tag type="dot" color="green" closable>标签一</Tag> <Tag type="dot" color="green">标签一</Tag>
<Tag type="dot" color="red">标签一</Tag> <Tag type="dot" color="green" closable>标签一</Tag>
<Tag type="dot" color="red" closable>标签一</Tag> <Tag type="dot" color="red">标签一</Tag>
<Tag type="dot" color="yellow">标签一</Tag> <Tag type="dot" color="red" closable>标签一</Tag>
<Tag type="dot" color="yellow" closable>标签一</Tag> <Tag type="dot" color="yellow">标签一</Tag>
<br><br> <Tag type="dot" color="yellow" closable>标签一</Tag>
<Tag type="border">标签一</Tag> <br><br>
<Tag type="border" closable>标签一</Tag> <Tag type="border">标签一</Tag>
<Tag type="border" color="blue">标签一</Tag> <Tag type="border" closable>标签一</Tag>
<Tag type="border" color="blue" closable>标签一</Tag> <Tag type="border" color="blue">标签一</Tag>
<Tag type="border" color="green">标签一</Tag> <Tag type="border" color="blue" closable>标签一</Tag>
<Tag type="border" color="green" closable>标签一</Tag> <Tag type="border" color="green">标签一</Tag>
<Tag type="border" color="red">标签一</Tag> <Tag type="border" color="green" closable>标签一</Tag>
<Tag type="border" color="red" closable>标签一</Tag> <Tag type="border" color="red">标签一</Tag>
<Tag type="border" color="yellow">标签一</Tag> <Tag type="border" color="red" closable>标签一</Tag>
<Tag type="border" color="yellow" closable>标签一</Tag> <Tag type="border" color="yellow">标签一</Tag>
<i-button type="primary" @click="modal1 = true">显示对话框</i-button> <Tag type="border" color="yellow" closable>标签一</Tag>
<Modal <Button type="primary" @click="modal1 = true">显示对话框</Button>
:visible.sync="modal1" <br><br>
title="普通的Modal对话框标题" <Tag v-if="ccc" closable @on-close="clickTagClose">标签一</Tag>
:loading="loading" @on-ok="ok"> </div>
<p>对话框内容</p>
<p>对话框内容</p>
<p>对话框内容</p>
{{ loading }}
<i-button @click="loading = true">true</i-button>
<i-button @click="loading = false">false</i-button>
</Modal>
<br><br>
<Tag type="border" color="yellow" closable @click="clickTag" @on-close="clickTagClose">标签一</Tag>
</template> </template>
<script> <script>
import { Tag, Modal, iButton } from 'iview'; import { Tag, Modal, iButton } from 'iview';
@ -50,7 +41,8 @@
data () { data () {
return { return {
modal1: false, modal1: false,
loading: true loading: true,
ccc: true
} }
}, },
methods: { methods: {
@ -63,6 +55,7 @@
console.log('click tag'); console.log('click tag');
}, },
clickTagClose() { clickTagClose() {
this.ccc = false;
console.log('click tag close-icon'); console.log('click tag close-icon');
} }
} }