Skip to content

Commit 19c32b0

Browse files
committed
Feature(mixin): add mixin demo page & add pre-load global scss support
1 parent a5f4f97 commit 19c32b0

File tree

20 files changed

+612
-129
lines changed

20 files changed

+612
-129
lines changed

package.json

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,9 @@
77
"serve": "vue-cli-service serve",
88
"build": "vue-cli-service build",
99
"lint": "vue-cli-service lint",
10+
"svg": "vsvg -s ./src/icons/svg -t ./src/icons/components --ext ts --es6",
1011
"test:e2e": "vue-cli-service test:e2e",
11-
"test:unit": "vue-cli-service test:unit",
12-
"svg": "vsvg -s ./src/icons/svg -t ./src/icons/components --ext ts --es6"
13-
},
14-
"keywords": [
15-
"vue",
16-
"typescript",
17-
"admin",
18-
"dashboard",
19-
"element-ui"
20-
],
21-
"repository": {
22-
"type": "git",
23-
"url": "git+https://github.com/armour/vue-typescript-admin-template.git"
24-
},
25-
"bugs": {
26-
"url": "https://github.com/armour/vue-typescript-admin-template/issues"
12+
"test:unit": "vue-cli-service test:unit"
2713
},
2814
"dependencies": {
2915
"@tinymce/tinymce-vue": "^2.0.0",
@@ -74,13 +60,13 @@
7460
"@types/tinymce": "^4.5.22",
7561
"@types/webpack-env": "^1.13.9",
7662
"@types/xlsx": "^0.0.36",
77-
"@vue/cli-plugin-babel": "^3.7.0",
78-
"@vue/cli-plugin-e2e-cypress": "^3.7.0",
79-
"@vue/cli-plugin-eslint": "^3.7.0",
80-
"@vue/cli-plugin-pwa": "^3.7.0",
81-
"@vue/cli-plugin-typescript": "^3.7.0",
82-
"@vue/cli-plugin-unit-jest": "^3.7.0",
83-
"@vue/cli-service": "^3.7.0",
63+
"@vue/cli-plugin-babel": "^3.8.0",
64+
"@vue/cli-plugin-e2e-cypress": "^3.8.0",
65+
"@vue/cli-plugin-eslint": "^3.8.0",
66+
"@vue/cli-plugin-pwa": "^3.8.0",
67+
"@vue/cli-plugin-typescript": "^3.8.1",
68+
"@vue/cli-plugin-unit-jest": "^3.8.0",
69+
"@vue/cli-service": "^3.8.0",
8470
"@vue/eslint-config-standard": "^4.0.0",
8571
"@vue/eslint-config-typescript": "^4.0.0",
8672
"@vue/test-utils": "^1.0.0-beta.29",
@@ -93,19 +79,35 @@
9379
"lint-staged": "^8.1.7",
9480
"sass": "^1.20.1",
9581
"sass-loader": "^7.1.0",
82+
"style-resources-loader": "^1.2.1",
9683
"ts-jest": "^24.0.2",
9784
"typescript": "3.4.5",
9885
"vue-cli-plugin-element": "^1.0.1",
86+
"vue-cli-plugin-style-resources-loader": "^0.1.3",
9987
"vue-template-compiler": "^2.6.10",
10088
"webpack": "^4.32.2"
10189
},
90+
"bugs": {
91+
"url": "https://github.com/armour/vue-typescript-admin-template/issues"
92+
},
10293
"gitHooks": {
10394
"pre-commit": "lint-staged"
10495
},
96+
"keywords": [
97+
"vue",
98+
"typescript",
99+
"admin",
100+
"template",
101+
"element-ui"
102+
],
105103
"lint-staged": {
106104
"*.{js,vue}": [
107105
"vue-cli-service lint",
108106
"git add"
109107
]
108+
},
109+
"repository": {
110+
"type": "git",
111+
"url": "git+https://github.com/armour/vue-typescript-admin-template.git"
110112
}
111113
}

src/components/DropdownMenu/index.vue

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<template>
2+
<div
3+
:class="{active: isActive}"
4+
class="share-dropdown-menu"
5+
>
6+
<div class="share-dropdown-menu-wrapper">
7+
<span
8+
class="share-dropdown-menu-title"
9+
@click.self="clickTitle"
10+
>{{ title }}</span>
11+
<div
12+
v-for="(item,index) of items"
13+
:key="index"
14+
class="share-dropdown-menu-item"
15+
>
16+
<a
17+
v-if="item.href"
18+
:href="item.href"
19+
target="_blank"
20+
>{{ item.title }}</a>
21+
<span v-else>{{ item.title }}</span>
22+
</div>
23+
</div>
24+
</div>
25+
</template>
26+
27+
<script lang="ts">
28+
import { Component, Prop, Vue } from 'vue-property-decorator'
29+
30+
@Component
31+
export default class DropdownMenu extends Vue {
32+
@Prop({ default: () => [] }) private items!: object[]
33+
@Prop({ default: 'vue' }) private title!: string
34+
35+
private isActive = false
36+
37+
private clickTitle() {
38+
this.isActive = !this.isActive
39+
}
40+
}
41+
</script>
42+
43+
<style lang="scss" scoped>
44+
$item-length: 10; // Should be no less than items.length
45+
$transition-time: .1s;
46+
47+
.share-dropdown-menu {
48+
width: 250px;
49+
position: relative;
50+
z-index: 1;
51+
52+
&-title {
53+
width: 100%;
54+
display: block;
55+
cursor: pointer;
56+
background: black;
57+
color: white;
58+
height: 60px;
59+
line-height: 60px;
60+
font-size: 20px;
61+
text-align: center;
62+
z-index: 2;
63+
transform: translate3d(0,0,0);
64+
}
65+
66+
&-wrapper {
67+
position: relative;
68+
}
69+
70+
&-item {
71+
text-align: center;
72+
position: absolute;
73+
width: 100%;
74+
background: #e0e0e0;
75+
line-height: 60px;
76+
height: 60px;
77+
cursor: pointer;
78+
font-size: 20px;
79+
opacity: 1;
80+
transition: transform 0.28s ease;
81+
82+
&:hover {
83+
background: black;
84+
color: white;
85+
}
86+
87+
@for $i from 1 through $item-length {
88+
&:nth-of-type(#{$i}) {
89+
z-index: -1;
90+
transition-delay: $i*$transition-time;
91+
transform: translate3d(0, -60px, 0);
92+
}
93+
}
94+
}
95+
96+
&.active {
97+
.share-dropdown-menu-wrapper {
98+
z-index: 1;
99+
}
100+
101+
.share-dropdown-menu-item {
102+
@for $i from 1 through $item-length {
103+
&:nth-of-type(#{$i}) {
104+
transition-delay: ($item-length - $i)*$transition-time;
105+
transform: translate3d(0, ($i - 1)*60px, 0);
106+
}
107+
}
108+
}
109+
}
110+
}
111+
</style>

src/components/UploadImage/index.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ export default class UploadImage extends Vue {
7474
</script>
7575

7676
<style lang="scss" scoped>
77-
@import "src/styles/mixin.scss";
78-
7977
.upload-container {
8078
width: 100%;
8179
position: relative;

src/layout/components/Sidebar/SidebarItem.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ export default class SidebarItem extends Vue {
122122
</script>
123123

124124
<style lang="scss">
125-
@import "src/styles/variables.scss";
126-
127125
.el-submenu.is-active > .el-submenu__title {
128126
color: $subMenuActiveText !important;
129127
}

src/layout/components/Sidebar/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { PermissionModule } from '@/store/modules/permission'
3434
import { SettingsModule } from '@/store/modules/settings'
3535
import Logo from './Logo.vue'
3636
import SidebarItem from './SidebarItem.vue'
37-
import variables from '@/styles/variables.scss'
37+
import variables from '@/styles/_variables.scss'
3838
3939
@Component({
4040
components: {

src/layout/index.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ export default class Layout extends mixins(ResizeMixin) {
7373
</script>
7474

7575
<style lang="scss" scoped>
76-
@import "src/styles/mixin.scss";
77-
@import "src/styles/variables.scss";
78-
7976
.app-wrapper {
8077
@include clearfix;
8178
position: relative;

src/router/modules/components.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ const componentsRouter: RouteConfig = {
5959
name: 'CountToDemo',
6060
meta: { title: 'countTo' }
6161
},
62-
// {
63-
// path: 'mixin',
64-
// component: () => import('@/views/components-demo/mixin'),
65-
// name: 'ComponentMixinDemo',
66-
// meta: { title: 'Component Mixin' }
67-
// },
62+
{
63+
path: 'mixin',
64+
component: () => import(/* webpackChunkName: "componentMixin" */ '@/views/components-demo/mixin.vue'),
65+
name: 'ComponentMixinDemo',
66+
meta: { title: 'componentMixin' }
67+
},
6868
{
6969
path: 'back-to-top',
7070
component: () => import(/* webpackChunkName: "backToTop" */ '@/views/components-demo/back-to-top.vue'),
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/styles/variables.scss renamed to src/styles/_variables.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/* base color */
2+
$blue:#324157;
3+
$light-blue:#3A71A8;
4+
$red:#C03639;
5+
$pink: #E65D6E;
6+
$green: #30B08F;
7+
$tiffany: #4AB7BD;
8+
$yellow:#FEC171;
9+
$panGreen: #30B08F;
10+
111
/* Sidebar */
212
$sideBarWidth: 210px;
313
$subMenuBg:#1f2d3d;
File renamed without changes.

src/styles/element-variables.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ $--table-border:1px solid#dfe6ec;
1414
$--font-path: '~element-ui/lib/theme-chalk/fonts';
1515

1616
// Apply overrided variables in Element UI
17-
@import "~element-ui/packages/theme-chalk/src/index";
17+
@import '~element-ui/packages/theme-chalk/src/index';
1818

1919
// The :export directive is the magic sauce for webpack
2020
// https://mattferderer.com/use-sass-variables-in-typescript-and-javascript

src/styles/index.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@import './element-variables.scss';
22
@import './variables.scss';
3-
@import './mixin.scss';
3+
@import './mixins.scss';
44
@import './transition.scss';
55
@import './svgicon.scss';
66

@@ -117,3 +117,7 @@ aside {
117117
text-align: center;
118118
}
119119
}
120+
121+
.text-center {
122+
text-align: center
123+
}

0 commit comments

Comments
 (0)