diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js index b1fe7c87..0a43f3a4 100755 --- a/build/webpack.base.conf.js +++ b/build/webpack.base.conf.js @@ -81,6 +81,10 @@ module.exports = { test: /\.scss$/, loaders: ["style", "css", "sass"] }, + { + test: /\.md$/, + loaders: ["text-loader"] + }, { test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, loader: 'url-loader', diff --git a/docs/zh/guide/change-log.md b/docs/zh/guide/change-log.md index 8af971e0..e5571582 100644 --- a/docs/zh/guide/change-log.md +++ b/docs/zh/guide/change-log.md @@ -11,6 +11,7 @@ * [ 修复 ] 首次加载 loading 样式类名和程序内类名冲突,新的加载类名使用 `d2-app-loading` 前缀 * [ 修改 ] 所有类似 `dd-` 的样式前缀(包括自动注册图标的id前缀)统一改为 `d2-` * [ 修复 ] 修复 `highlight` 组件和 `markdown` 组件的样式冲突 +* [ 修改 ] 内置组件名称统一改为 `d2-` 前缀,统一使用横线连接 (kebab-case) 风格 ## v1.0.0 diff --git a/package.json b/package.json index 84dbbf7b..9d756c5d 100755 --- a/package.json +++ b/package.json @@ -80,6 +80,7 @@ "semver": "^5.3.0", "shelljs": "^0.7.6", "svg-sprite-loader": "^3.6.2", + "text-loader": "0.0.1", "uglifyjs-webpack-plugin": "^1.1.1", "url-loader": "^0.5.8", "vue-loader": "^13.3.0", diff --git a/src/assets/style/fixed/element.scss b/src/assets/style/fixed/element.scss index be34caca..ce0144a0 100644 --- a/src/assets/style/fixed/element.scss +++ b/src/assets/style/fixed/element.scss @@ -1,10 +1,13 @@ // element 样式补丁 .el-card { - box-shadow: none; - &:hover { - // box-shadow: 0 0 8px 0 rgba(232,237,250,.6), 0 2px 4px 0 rgba(232,237,250,.5); - box-shadow: none; + &.is-always-shadow { + box-shadow: 0 0 8px 0 rgba(232,237,250,.6), 0 2px 4px 0 rgba(232,237,250,.5); + } + &.is-hover-shadow { + &:hover { + box-shadow: 0 0 8px 0 rgba(232,237,250,.6), 0 2px 4px 0 rgba(232,237,250,.5); + } } } diff --git a/src/assets/style/theme/d2/index.scss b/src/assets/style/theme/d2/index.scss new file mode 100644 index 00000000..cad7dab9 --- /dev/null +++ b/src/assets/style/theme/d2/index.scss @@ -0,0 +1,156 @@ +@import '../theme.scss'; +@import './setting.scss'; + +.theme-#{$theme-name} { + + .layout-main { + background-color: $theme-bg-color; + // background-image: url($theme-bg-image); + } + // 菜单项目 + @mixin theme-menu-hover-style { + color: $theme-menu-item-color-hover; + i { + color: $theme-menu-item-color-hover; + } + background-color: $theme-menu-item-background-color-hover; + } + .el-submenu__title:hover { + @include theme-menu-hover-style; + } + .el-menu-item:hover { + @include theme-menu-hover-style; + } + .el-menu--horizontal .el-menu-item:not(.is-disabled):hover { + @include theme-menu-hover-style; + } + .el-menu--horizontal .el-menu .el-submenu__title:hover { + @include theme-menu-hover-style; + } + + // [组件] d2-container-full + .d2-container-full { + border: $theme-container-border; + border-bottom: none; + .d2-container-full__header { + border-bottom: $theme-container-border; + } + .d2-container-full__footer { + border-top: $theme-container-border; + } + } + // [组件] d2-container-card + .d2-container-card { + border: $theme-container-border; + .el-card__header { + border-bottom: $theme-container-border; + } + } + // 顶栏 + .el-header { + // 切换按钮 + .toggle-aside-btn { + i { + color: $theme-header-item-color; + background-color: $theme-header-item-background-color; + &:hover { + color: $theme-header-item-color-hover; + } + } + } + // 顶栏菜单 + .el-menu { + .el-menu-item { + transition: border-top-color 0s; + color: $theme-header-item-color; + background-color: $theme-header-item-background-color; + &:hover { + color: $theme-header-item-color-hover; + background-color: $theme-header-item-background-color-hover; + } + &:focus { + color: $theme-header-item-color-focus; + background-color: $theme-header-item-background-color-focus; + } + &.is-active { + color: $theme-header-item-color-active; + background-color: $theme-header-item-background-color-active; + } + } + .el-submenu { + .el-submenu__title { + transition: border-top-color 0s; + color: $theme-header-item-color; + background-color: $theme-header-item-background-color; + .el-submenu__icon-arrow { + color: $theme-header-item-color; + } + &:hover { + color: $theme-header-item-color-hover; + background-color: $theme-header-item-background-color-hover; + } + &:focus { + color: $theme-header-item-color-focus; + background-color: $theme-header-item-background-color-focus; + } + } + } + } + // 顶栏右侧 + .d2-header-right { + .btn-text { + color: $theme-header-item-color; + &.can-hover { + &:hover { + color: $theme-header-item-color-hover; + background-color: $theme-header-item-background-color-hover; + } + } + } + } + } + // [布局] 顶栏下面 + .el-container { + // 侧边栏 + .el-aside { + // [菜单] 正常状态 + .el-menu { + .el-menu-item { + color: $theme-aside-item-color; + background-color: $theme-aside-item-background-color; + i { + color: $theme-aside-item-color; + } + &:hover { + color: $theme-aside-item-color-hover; + background-color: $theme-aside-item-background-color-hover; + } + &:focus { + color: $theme-aside-item-color-focus; + background-color: $theme-aside-item-background-color-focus; + } + &.is-active { + color: $theme-aside-item-color-active; + background-color: $theme-aside-item-background-color-active; + } + } + } + .el-submenu { + .el-submenu__title { + color: $theme-aside-item-color; + background-color: $theme-aside-item-background-color; + i { + color: $theme-aside-item-color; + } + .el-submenu__icon-arrow { + color: $theme-aside-item-color; + } + &:hover { + color: $theme-aside-item-color-hover; + background-color: $theme-aside-item-background-color-hover; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/assets/style/theme/d2/setting.scss b/src/assets/style/theme/d2/setting.scss new file mode 100644 index 00000000..e9ce12b8 --- /dev/null +++ b/src/assets/style/theme/d2/setting.scss @@ -0,0 +1,38 @@ +// 主题名称 +$theme-name: 'd2'; +// 主题背景颜色 +$theme-bg-color: $color-bg; +// 主题背景图片 +// $theme-bg-image: '/static/image/bg/xxx.jpg'; +// container组件的边框 +$theme-container-border: 1px solid $color-border-1; + +// 顶栏和侧边栏中展开的菜单 hover 状态下 +$theme-menu-item-color-hover: #293849; +$theme-menu-item-background-color-hover: #ecf5ff; + +// 顶栏上的文字颜色 +$theme-header-item-color: $color-text-normal; +$theme-header-item-background-color: transparent; +// 顶栏上的项目在 hover 时 +$theme-header-item-color-hover: $color-text-main; +$theme-header-item-background-color-hover: rgba(#000, .02); +// 顶栏上的项目在 focus 时 +$theme-header-item-color-focus: $color-text-main; +$theme-header-item-background-color-focus: rgba(#000, .02); +// 顶栏上的项目在 active 时 +$theme-header-item-color-active: $color-text-main; +$theme-header-item-background-color-active: rgba(#000, .03); + +// 侧边栏上的文字颜色 +$theme-aside-item-color: $color-text-normal; +$theme-aside-item-background-color: transparent; +// 侧边栏上的项目在 hover 时 +$theme-aside-item-color-hover: $color-text-main; +$theme-aside-item-background-color-hover: rgba(#000, .02); +// 侧边栏上的项目在 focus 时 +$theme-aside-item-color-focus: $color-text-main; +$theme-aside-item-background-color-focus: rgba(#000, .02); +// 侧边栏上的项目在 active 时 +$theme-aside-item-color-active: $color-text-main; +$theme-aside-item-background-color-active: rgba(#000, .03); \ No newline at end of file diff --git a/src/assets/style/theme/star/index.scss b/src/assets/style/theme/star/index.scss index ade5965a..e2221d38 100644 --- a/src/assets/style/theme/star/index.scss +++ b/src/assets/style/theme/star/index.scss @@ -1,20 +1,19 @@ @import '../theme.scss'; - -$theme-name: 'star'; -$theme-bg-color: #EFF4F8; -$theme-bg-image: '/static/image/bg/star.jpg'; -$theme-container-full-border-color: #d8dfea; +@import './setting.scss'; .theme-#{$theme-name} { - .theme { + + .layout-main { background-color: $theme-bg-color; background-image: url($theme-bg-image); - background-size: cover; - background-position: center; } // 菜单项目 @mixin theme-menu-hover-style { - background-color: #eff4f8; + color: $theme-menu-item-color-hover; + i { + color: $theme-menu-item-color-hover; + } + background-color: $theme-menu-item-background-color-hover; } .el-submenu__title:hover { @include theme-menu-hover-style; @@ -28,13 +27,21 @@ $theme-container-full-border-color: #d8dfea; .el-menu--horizontal .el-menu .el-submenu__title:hover { @include theme-menu-hover-style; } + // [组件] d2-container-full .d2-container-full { .d2-container-full__header { - border-bottom: 1px solid $theme-container-full-border-color; + border-bottom: $theme-container-border; } .d2-container-full__footer { - border-top: 1px solid $theme-container-full-border-color; + border-top: $theme-container-border; + } + } + // [组件] d2-container-card + .d2-container-card { + border: $theme-container-border; + .el-card__header { + border-bottom: $theme-container-border; } } // 顶栏 @@ -42,9 +49,10 @@ $theme-container-full-border-color: #d8dfea; // 切换按钮 .toggle-aside-btn { i { - color: #FFF; + color: $theme-header-item-color; + background-color: $theme-header-item-background-color; &:hover { - color: #FFF; + color: $theme-header-item-color-hover; } } } @@ -52,29 +60,36 @@ $theme-container-full-border-color: #d8dfea; .el-menu { .el-menu-item { transition: border-top-color 0s; - color: #FFF; + color: $theme-header-item-color; + background-color: $theme-header-item-background-color; &:hover { - background-color: rgba(#FFF, .3); + color: $theme-header-item-color-hover; + background-color: $theme-header-item-background-color-hover; } &:focus { - background-color: rgba(#FFF, .3); + color: $theme-header-item-color-focus; + background-color: $theme-header-item-background-color-focus; } &.is-active { - background-color: rgba(#000, .3); + color: $theme-header-item-color-active; + background-color: $theme-header-item-background-color-active; } } .el-submenu { .el-submenu__title { transition: border-top-color 0s; - color: #FFF; + color: $theme-header-item-color; + background-color: $theme-header-item-background-color; + .el-submenu__icon-arrow { + color: $theme-header-item-color; + } &:hover { - background-color: rgba(#FFF, .3); + color: $theme-header-item-color-hover; + background-color: $theme-header-item-background-color-hover; } &:focus { - background-color: rgba(#FFF, .3); - } - .el-submenu__icon-arrow { - color: #FFF; + color: $theme-header-item-color-focus; + background-color: $theme-header-item-background-color-focus; } } } @@ -82,9 +97,12 @@ $theme-container-full-border-color: #d8dfea; // 顶栏右侧 .d2-header-right { .btn-text { - color: #FFF; - &:hover { - background-color: rgba(#FFF, .1); + color: $theme-header-item-color; + &.can-hover { + &:hover { + color: $theme-header-item-color-hover; + background-color: $theme-header-item-background-color-hover; + } } } } @@ -96,32 +114,38 @@ $theme-container-full-border-color: #d8dfea; // [菜单] 正常状态 .el-menu { .el-menu-item { - color: #FFF; + color: $theme-aside-item-color; + background-color: $theme-aside-item-background-color; + i { + color: $theme-aside-item-color; + } &:hover { - background-color: rgba(#FFF, .3); + color: $theme-aside-item-color-hover; + background-color: $theme-aside-item-background-color-hover; } &:focus { - background-color: rgba(#FFF, .3); - } - i { - color: #FFF; + color: $theme-aside-item-color-focus; + background-color: $theme-aside-item-background-color-focus; } &.is-active { - background-color: rgba(#000, .3); + color: $theme-aside-item-color-active; + background-color: $theme-aside-item-background-color-active; } } } .el-submenu { .el-submenu__title { - color: #FFF; - &:hover { - background-color: rgba(#FFF, .3); - } + color: $theme-aside-item-color; + background-color: $theme-aside-item-background-color; i { - color: #FFF; + color: $theme-aside-item-color; } .el-submenu__icon-arrow { - color: #FFF; + color: $theme-aside-item-color; + } + &:hover { + color: $theme-aside-item-color-hover; + background-color: $theme-aside-item-background-color-hover; } } } diff --git a/src/assets/style/theme/star/setting.scss b/src/assets/style/theme/star/setting.scss new file mode 100644 index 00000000..11c9cb77 --- /dev/null +++ b/src/assets/style/theme/star/setting.scss @@ -0,0 +1,38 @@ +// 主题名称 +$theme-name: 'star'; +// 主题背景颜色 +$theme-bg-color: #EFF4F8; +// 主题背景图片 +$theme-bg-image: '/static/image/bg/star.jpg'; +// container组件的边框 +$theme-container-border: 1px solid #d8dfea; + +// 顶栏和侧边栏中展开的菜单 hover 状态下 +$theme-menu-item-color-hover: #293849; +$theme-menu-item-background-color-hover: #ecf5ff; + +// 顶栏上的文字颜色 +$theme-header-item-color: #FFF; +$theme-header-item-background-color: transparent; +// 顶栏上的项目在 hover 时 +$theme-header-item-color-hover: #FFF; +$theme-header-item-background-color-hover: rgba(#000, .2); +// 顶栏上的项目在 focus 时 +$theme-header-item-color-focus: #FFF; +$theme-header-item-background-color-focus: rgba(#000, .2); +// 顶栏上的项目在 active 时 +$theme-header-item-color-active: #FFF; +$theme-header-item-background-color-active: rgba(#000, .3); + +// 侧边栏上的文字颜色 +$theme-aside-item-color: #FFF; +$theme-aside-item-background-color: transparent; +// 侧边栏上的项目在 hover 时 +$theme-aside-item-color-hover: #FFF; +$theme-aside-item-background-color-hover: rgba(#000, .2); +// 侧边栏上的项目在 focus 时 +$theme-aside-item-color-focus: #FFF; +$theme-aside-item-background-color-focus: rgba(#000, .2); +// 侧边栏上的项目在 active 时 +$theme-aside-item-color-active: #FFF; +$theme-aside-item-background-color-active: rgba(#000, .3); \ No newline at end of file diff --git a/src/assets/style/theme/theme.scss b/src/assets/style/theme/theme.scss index 3f1af9ed..70187876 100644 --- a/src/assets/style/theme/theme.scss +++ b/src/assets/style/theme/theme.scss @@ -1,9 +1,11 @@ @import '~@/assets/style/public.scss'; // 主题公用 -.theme { +.layout-main { height: 100vh; width: 100vw; + background-size: cover; + background-position: center; // [布局] 顶栏 .el-header { padding: 0px; diff --git a/src/components/core/d2-container/index.vue b/src/components/core/d2-container/index.vue index 71bb2f08..84d2eb84 100644 --- a/src/components/core/d2-container/index.vue +++ b/src/components/core/d2-container/index.vue @@ -1,7 +1,7 @@ + + diff --git a/src/pages/demo/components/container/ghost.vue b/src/pages/demo/components/container/ghost.vue index 788779e6..6250aea8 100644 --- a/src/pages/demo/components/container/ghost.vue +++ b/src/pages/demo/components/container/ghost.vue @@ -1,7 +1,18 @@ + + diff --git a/static/md/组件 - 页面容器 - 基础.md b/src/pages/demo/components/container/md/doc-card.md similarity index 100% rename from static/md/组件 - 页面容器 - 基础.md rename to src/pages/demo/components/container/md/doc-card.md diff --git a/static/md/组件 - 页面容器 - 撑满.md b/src/pages/demo/components/container/md/doc-full.md similarity index 98% rename from static/md/组件 - 页面容器 - 撑满.md rename to src/pages/demo/components/container/md/doc-full.md index df8b36f4..a254fc10 100644 --- a/static/md/组件 - 页面容器 - 撑满.md +++ b/src/pages/demo/components/container/md/doc-full.md @@ -72,4 +72,4 @@ Element,一套为开发者、设计师和产品经理准备的基于 Vue 2.0 - 用户决策:根据场景可给予用户操作建议或安全提示,但不能代替用户进行决策; -- 结果可控:用户可以自由的进行操作,包括撤销、回退和终止当前操作等。 +- 结果可控:用户可以自由的进行操作,包括撤销、回退和终止当前操作等。 \ No newline at end of file diff --git a/static/md/组件 - 页面容器 - 隐形.md b/src/pages/demo/components/container/md/doc-ghost.md similarity index 100% rename from static/md/组件 - 页面容器 - 隐形.md rename to src/pages/demo/components/container/md/doc-ghost.md diff --git a/src/pages/demo/components/container/normal.vue b/src/pages/demo/components/container/normal.vue deleted file mode 100644 index 2bea1196..00000000 --- a/src/pages/demo/components/container/normal.vue +++ /dev/null @@ -1,6 +0,0 @@ - diff --git a/src/pages/demo/components/countup/index.vue b/src/pages/demo/components/countup/index.vue index ef6a6f8b..e5e59243 100644 --- a/src/pages/demo/components/countup/index.vue +++ b/src/pages/demo/components/countup/index.vue @@ -1,11 +1,9 @@ @@ -85,7 +80,6 @@ export default { .page { .el-card { @extend %unable-select; - margin-bottom: $margin; .group { display: flex; justify-content: center; diff --git a/src/pages/demo/components/editor-quill/index.vue b/src/pages/demo/components/editor-quill/index.vue index 5ab2a667..fee97be8 100644 --- a/src/pages/demo/components/editor-quill/index.vue +++ b/src/pages/demo/components/editor-quill/index.vue @@ -1,16 +1,13 @@