fix(components): [date-picker] date-table-cell namespace (#7684)

* fix(components): date-table-cell & scrollbar namespace

* fix(components): revert scroll className & add comment
This commit is contained in:
云游君
2022-05-16 20:58:50 +08:00
committed by GitHub
parent 6521dbb42a
commit 7a45b88783
3 changed files with 6 additions and 3 deletions

View File

@@ -44,7 +44,6 @@ declare module '@vue/runtime-core' {
Playground: typeof import('./.vitepress/vitepress/components/icons/playground.vue')['default']
Resource: typeof import('./.vitepress/vitepress/components/globals/resource.vue')['default']
ResourceSvg: typeof import('./.vitepress/vitepress/components/home/svg/resource-svg.vue')['default']
Right: typeof import('./.vitepress/vitepress/components/sponsors/right.vue')['default']
RightLayerSvg: typeof import('./.vitepress/vitepress/components/home/svg/right-layer-svg.vue')['default']
RightRichtextList: typeof import('./.vitepress/vitepress/components/sponsors/right-richtext-list.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']

View File

@@ -1,5 +1,6 @@
import { defineComponent, h, inject } from 'vue'
import { buildProps, definePropType } from '@element-plus/utils'
import { useNamespace } from '@element-plus/hooks'
import { ROOT_PICKER_INJECTION_KEY } from '../date-picker.type'
import type { DateCell } from '../date-picker.type'
@@ -11,6 +12,7 @@ export default defineComponent({
},
}),
setup(props) {
const ns = useNamespace('date-table-cell')
const picker = inject(ROOT_PICKER_INJECTION_KEY)
return () => {
const cell = props.cell
@@ -27,13 +29,13 @@ export default defineComponent({
return h(
'div',
{
class: 'el-date-table-cell',
class: ns.b(),
},
[
h(
'span',
{
class: 'el-date-table-cell__text',
class: ns.e('text'),
},
[cell?.text]
),

View File

@@ -40,6 +40,8 @@ export const getScrollBarWidth = (): number => {
if (scrollBarWidth !== undefined) return scrollBarWidth
const outer = document.createElement('div')
// Cannot access 'propKey' before initialization
// need to be dynamic namespace
outer.className = 'el-scrollbar__wrap'
outer.style.visibility = 'hidden'
outer.style.width = '100px'