123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import baseComponent from '../helpers/baseComponent'
- import classNames from '../helpers/classNames'
- baseComponent({
- relations: {
- '../cell/index': {
- type: 'child',
- observer() {
- this.debounce(this.updateIsLastElement)
- },
- },
- },
- properties: {
- prefixCls: {
- type: String,
- value: 'wux-cell-group',
- },
- title: {
- type: String,
- value: '',
- },
- label: {
- type: String,
- value: '',
- },
- },
- computed: {
- classes() {
- const { prefixCls } = this.data
- const wrap = classNames(prefixCls)
- const hd = `${prefixCls}__hd`
- const bd = `${prefixCls}__bd`
- const ft = `${prefixCls}__ft`
- return {
- wrap,
- hd,
- bd,
- ft,
- }
- },
- },
- methods: {
- updateIsLastElement() {
- const elements = this.getRelationNodes('../cell/index')
- if (elements.length > 0) {
- const lastIndex = elements.length - 1
- elements.forEach((element, index) => {
- element.updateIsLastElement(index === lastIndex)
- })
- }
- },
- },
- })
|