init breadcrumb
This commit is contained in:
parent
f8e3474a04
commit
bed63ac986
|
@ -0,0 +1,5 @@
|
|||
import { render } from 'omi'
|
||||
import './assets/index.css'
|
||||
import './elements/breadcrumb'
|
||||
|
||||
render(<my-app />, '#root')
|
|
@ -0,0 +1,27 @@
|
|||
import { tag, WeElement } from 'omi'
|
||||
import style from './_index.css'
|
||||
import '../../omi-element-ui/el-breadcrumb'
|
||||
import '../../omi-element-ui/el-breadcrumb-item'
|
||||
|
||||
@tag('my-app')
|
||||
class MyApp extends WeElement {
|
||||
|
||||
css() {
|
||||
return style
|
||||
}
|
||||
|
||||
render(props, data) {
|
||||
return (
|
||||
<div>
|
||||
<div>
|
||||
<el-breadcrumb separator={"/"}>
|
||||
<el-breadcrumb-item >首页</el-breadcrumb-item>
|
||||
<el-breadcrumb-item><a href="/">活动管理</a></el-breadcrumb-item>
|
||||
<el-breadcrumb-item>活动列表</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>活动详情</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
import { tag, WeElement } from 'omi'
|
||||
import '../style/global/index.css'
|
||||
import style from '../style/breadcrumb-item.scss'
|
||||
|
||||
@tag('el-breadcrumb-item', true)
|
||||
class ElBreadcrumbItem extends WeElement {
|
||||
|
||||
css() {
|
||||
return style
|
||||
}
|
||||
|
||||
install() {
|
||||
this._initData()
|
||||
}
|
||||
|
||||
_initData() {
|
||||
if (this.parentNode.nodeName === 'EL-BREADCRUMB') {
|
||||
console.log(this.parentNode.data.separator);
|
||||
this.data.separator = this.parentNode.data.separator
|
||||
}
|
||||
}
|
||||
|
||||
render(props, data) {
|
||||
console.log(props, data);
|
||||
let {separator} = props;
|
||||
return (
|
||||
<span class="el-breadcrumb__item">
|
||||
<span class="el-breadcrumb__inner is-link">
|
||||
<slot></slot>
|
||||
</span>
|
||||
<i class="el-breadcrumb__separator" class="separatorClass"></i>
|
||||
<span v-else class="el-breadcrumb__separator" role="presentation">
|
||||
{{separator}}
|
||||
</span>
|
||||
</span>
|
||||
)
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
import { tag, WeElement } from 'omi'
|
||||
|
||||
@tag('el-breadcrumb', true)
|
||||
class ElBreadcrumb extends WeElement {
|
||||
render(props, data) {
|
||||
return (
|
||||
<div class="el-breadcrumb" aria-label="Breadcrumb">
|
||||
<slot></slot>
|
||||
</div>
|
||||
)
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue