-
-
Notifications
You must be signed in to change notification settings - Fork 616
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
216 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<template> | ||
<div class="var-cell" :class="[border ? 'var-cell--border' : null]"> | ||
<div class="var-cell__icon" :class="[iconClass ? iconClass : null]" v-if="$slots.icon || icon"> | ||
<slot name="icon"> | ||
<var-icon :name="icon" /> | ||
</slot> | ||
</div> | ||
<div class="var-cell__content"> | ||
<div class="var-cell__title" :class="[titleClass ? titleClass : null]"> | ||
<slot>{{ title }}</slot> | ||
</div> | ||
<div class="var-cell__label" :class="[labelClass ? labelClass : null]" v-if="$slots.label || label"> | ||
<slot name="label"> | ||
{{ label }} | ||
</slot> | ||
</div> | ||
</div> | ||
<div class="var-cell__extra" :class="[extraClass ? extraClass : null]" v-if="$slots.extra"> | ||
<slot name="extra"></slot> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue' | ||
import { props } from './props' | ||
import Icon from '../icon' | ||
export default defineComponent({ | ||
name: 'VarCell', | ||
components: { | ||
[Icon.name]: Icon, | ||
}, | ||
props, | ||
}) | ||
</script> | ||
|
||
<style lang="less"> | ||
@import './cell'; | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const Cell = require('../../../cjs/cell').default | ||
const { render } = require('@testing-library/vue') | ||
|
||
test('test cell', async () => { | ||
const wrapper = render(Cell) | ||
console.log(wrapper) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
@import '../styles/var'; | ||
|
||
.var-cell { | ||
align-items: center; | ||
display: flex; | ||
min-height: 40px; | ||
outline: none; | ||
padding: 10px 16px; | ||
position: relative; | ||
font-size: @font-size-md; | ||
&--border { | ||
&:after { | ||
position: absolute; | ||
box-sizing: border-box; | ||
content: ' '; | ||
pointer-events: none; | ||
right: 16px; | ||
bottom: 0; | ||
left: 16px; | ||
border-bottom: 1px solid #bcc2cb; | ||
transform: scaleY(0.5); | ||
} | ||
} | ||
|
||
&__icon { | ||
margin-right: 12px; | ||
flex: 0; | ||
} | ||
|
||
&__content { | ||
flex: 1; | ||
overflow: hidden; | ||
} | ||
|
||
&__title { | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
} | ||
|
||
&__label { | ||
font-size: @font-size-sm; | ||
color: rgba(0, 0, 0, 0.6); | ||
} | ||
|
||
&__extra { | ||
flex: 0; | ||
margin-left: 12px; | ||
} | ||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<template> | ||
<div> | ||
<app-type>基本使用</app-type> | ||
<var-cell> This is Cell </var-cell> | ||
<var-cell> This is Cell </var-cell> | ||
</div> | ||
<div> | ||
<app-type>显示icon</app-type> | ||
<var-cell icon="fire" title="This is Cell"> | ||
<template #extra> | ||
<var-icon name="information" /> | ||
</template> | ||
</var-cell> | ||
<var-cell icon="fire" title="This is Cell"> | ||
<template #extra> | ||
<var-icon name="information" /> | ||
</template> | ||
</var-cell> | ||
</div> | ||
<div> | ||
<app-type>显示副标题</app-type> | ||
<var-cell icon="fire" title="This is Cell" label="description"> | ||
<template #extra> | ||
<var-icon name="information" /> | ||
</template> | ||
</var-cell> | ||
<var-cell title="This is Cell" label="description" /> | ||
</div> | ||
<div> | ||
<app-type>显示分割线</app-type> | ||
<var-cell border> This is Cell </var-cell> | ||
<var-cell border> This is Cell </var-cell> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { defineComponent } from 'vue' | ||
import Icon from '../../icon' | ||
import Cell from '..' | ||
export default defineComponent({ | ||
name: 'CellExample', | ||
components: { | ||
[Cell.name]: Cell, | ||
[Icon.name]: Icon, | ||
}, | ||
}) | ||
</script> | ||
|
||
<style scoped> | ||
.example { | ||
background: antiquewhite; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { App } from 'vue' | ||
import Cell from './Cell.vue' | ||
|
||
Cell.install = function (app: App) { | ||
app.component(Cell.name, Cell) | ||
} | ||
|
||
export default Cell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export const props = { | ||
title: { | ||
type: [Number, String], | ||
}, | ||
icon: { | ||
type: String, | ||
}, | ||
label: { | ||
type: String, | ||
}, | ||
border: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
iconClass: { | ||
type: String, | ||
}, | ||
titleClass: { | ||
type: String, | ||
}, | ||
labelClass: { | ||
type: String, | ||
}, | ||
extraClass: { | ||
type: String, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters