Skip to content

Commit b2bf2ac

Browse files
author
M-Ray
committed
feat: add rollup-less-plugin
1 parent c6de6e9 commit b2bf2ac

File tree

15 files changed

+9288
-5238
lines changed

15 files changed

+9288
-5238
lines changed

.babelrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"presets": [
3+
["@babel/preset-env"], ["@vue/babel-preset-jsx", {
4+
"injectH": false
5+
}]
6+
]
7+
}

examples/babel.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
presets: [
3+
'@vue/cli-plugin-babel/preset'
4+
]
5+
}

examples/package.json

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "docs-example",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "npm run serve",
7+
"serve": "vue-cli-service serve",
8+
"build": "vue-cli-service build",
9+
"lint": "vue-cli-service lint"
10+
},
11+
"dependencies": {
12+
"core-js": "^3.6.4",
13+
"vue-github-button": "^1.1.2",
14+
"vue-router": "^3.1.6"
15+
},
16+
"devDependencies": {
17+
"@vue/cli-plugin-babel": "~4.3.0",
18+
"@vue/cli-plugin-eslint": "~4.3.0",
19+
"@vue/cli-plugin-router": "^4.3.0",
20+
"@vue/cli-service": "~4.3.0",
21+
"babel-eslint": "^10.1.0",
22+
"eslint": "^6.7.2",
23+
"eslint-plugin-vue": "^6.2.2",
24+
"less": "^3.11.1",
25+
"less-loader": "^5.0.0",
26+
"raw-loader": "^4.0.0",
27+
"vue-template-compiler": "^2.6.11"
28+
},
29+
"eslintConfig": {
30+
"root": true,
31+
"env": {
32+
"node": true
33+
},
34+
"extends": [
35+
"plugin:vue/essential",
36+
"eslint:recommended"
37+
],
38+
"parserOptions": {
39+
"parser": "babel-eslint"
40+
},
41+
"rules": {}
42+
},
43+
"browserslist": [
44+
"> 1%",
45+
"last 2 versions",
46+
"not dead"
47+
]
48+
}

examples/public/index.html

+3-7
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@
66
<meta name="viewport" content="width=device-width,initial-scale=1.0">
77
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
88
<title><%= htmlWebpackPlugin.options.title %></title>
9-
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>
10-
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet">
11-
<% } %>
12-
13-
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
14-
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
15-
<% } %>
9+
<link rel="stylesheet" href="<%= BASE_URL %>milligram.css" />
10+
<link rel="stylesheet" href="<%= BASE_URL %>highlight/theme.css" />
11+
<script src="<%= BASE_URL %>highlight/pack.js"></script>
1612
</head>
1713
<body>
1814
<noscript>

src/App.vue renamed to examples/src/App.vue

+92-23
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,39 @@
11
<template>
22
<div id="app">
3-
<Tree
3+
<div id="nav">
4+
<router-link to="/">home</router-link>
5+
<span class="line">|</span>
6+
<router-link to="/fixed-size">fixed size</router-link>
7+
<span class="line">|</span>
8+
<router-link to="/dynamic-size">dynamic size</router-link>
9+
<span class="line">|</span>
10+
<router-link to="/horizontal">horizontal</router-link>
11+
<span class="line">|</span>
12+
<router-link to="/infinite-loading">infinite loading</router-link>
13+
<span class="line">|</span>
14+
<router-link to="/keep-state">keep state</router-link>
15+
<span class="line">|</span>
16+
<router-link to="/page-mode">page mode</router-link>
17+
<span class="line">|</span>
18+
<router-link to="/chat-room">chat room</router-link>
19+
</div>
20+
<router-view />
21+
22+
<!-- <Tree
423
:tree-data="demeData"
524
expandedAll
625
show-checkbox
726
hasHalfelEction
827
draggable
928
@on-checkbox-change="handleChangeCheckBox"
1029
@on-checked-item="handleChangeItem">
11-
</Tree>
30+
</Tree> -->
1231
</div>
1332
</template>
1433

1534
<script>
16-
import Tree from './components/Tree/Tree'
17-
import Mock from './utils/mock'
1835
export default {
1936
name: 'App',
20-
components: {
21-
Tree
22-
},
2337
data () {
2438
return {
2539
visible: true,
@@ -128,28 +142,28 @@ export default {
128142
}
129143
},
130144
created () {
131-
this.genBaseData()
145+
// this.genBaseData()
132146
console.log(this.baseData)
133147
},
134148
methods: {
135149
toggleVisible () {
136150
this.visible = !this.visible
137151
},
138152
genBaseData () {
139-
const start = Math.round(Math.random())
140-
const end = start + Math.round(Math.random() * 4)
141-
const res = Mock.mock({
142-
'data|10': [
143-
{
144-
'id': /[a-z]{2}[A-Z]{2}[0-9]/,
145-
'status|1': ['success', 'fail'],
146-
'tags|1-2': ['success', 'normal', 'warning', 'error'].slice(start, end),
147-
'time': '@date("yyyy-MM-dd")',
148-
'name': "@ctitle(4,6)",
149-
}
150-
]
151-
})
152-
this.baseData = res.data
153+
//
154+
// const res = Mock.mock({
155+
// 'data|10': [
156+
// {const start = Math.round(Math.random())
157+
// const end = start + Math.round(Math.random() * 4)
158+
// 'id': /[a-z]{2}[A-Z]{2}[0-9]/,
159+
// 'status|1': ['success', 'fail'],
160+
// 'tags|1-2': ['success', 'normal', 'warning', 'error'].slice(start, end),
161+
// 'time': '@date("yyyy-MM-dd")',
162+
// 'name': "@ctitle(4,6)",
163+
// }
164+
// ]
165+
// })
166+
// this.baseData = res.data
153167
},
154168
handleClick (data) {
155169
console.log(data)
@@ -169,10 +183,11 @@ export default {
169183
font-family: Avenir, Helvetica, Arial, sans-serif;
170184
-webkit-font-smoothing: antialiased;
171185
-moz-osx-font-smoothing: grayscale;
172-
text-align: center;
186+
/* text-align: center; */
173187
color: #2c3e50;
174188
margin-top: 60px;
175189
}
190+
176191
</style>
177192
<style lang="less">
178193
@transition-time : .2s;
@@ -182,6 +197,60 @@ export default {
182197
@unimportance-color: #b7beca;
183198
@border-radius-small : 3px;
184199
200+
#nav {
201+
position: fixed;
202+
top: 0;
203+
left: 0;
204+
right: 0;
205+
background-color: #9b4cca;
206+
color: #fff;
207+
height: 40px;
208+
display: flex;
209+
align-items: center;
210+
padding-left: 1em;
211+
white-space: nowrap;
212+
overflow-x: auto;
213+
z-index: 2;
214+
@media (max-width: 640px) {
215+
padding: 0;
216+
position: relative;
217+
background-color: unset;
218+
color: unset;
219+
height: unset;
220+
padding-left: unset;
221+
align-items: unset;
222+
}
223+
a {
224+
display: inline-block;
225+
color: #fff;
226+
@media (max-width: 640px) {
227+
margin-bottom: 0;
228+
margin-right: 1em;
229+
color: #9b4dca;
230+
}
231+
}
232+
.line {
233+
margin: 0 1em;
234+
font-size: 14px;
235+
color: pink;
236+
@media (max-width: 640px) {
237+
display: none;
238+
}
239+
}
240+
.router-link-exact-active,
241+
.router-link-exact-active:hover {
242+
color: inherit;
243+
cursor: default;
244+
text-decoration: underline;
245+
@media (max-width: 640px) {
246+
border-bottom: 1px solid;
247+
border-color: #606c76;
248+
text-decoration: none;
249+
}
250+
251+
}
252+
}
253+
185254
.frame {
186255
// position: absolute;
187256
height: 300px;
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import Vue from 'vue'
22
import App from './App.vue'
3-
// import shscUI from 'shsc-ui'
3+
import router from './router'
4+
45

56
Vue.config.productionTip = false
6-
// Vue.use(shscUI)
77

88
new Vue({
9+
router,
910
render: h => h(App),
1011
}).$mount('#app')

examples/src/router/index.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Vue from 'vue'
2+
import VueRouter from 'vue-router'
3+
import Base from '../views/base/index.vue'
4+
5+
6+
Vue.use(VueRouter)
7+
8+
const routes = [
9+
{
10+
path: '/',
11+
name: 'home',
12+
component: Base
13+
}
14+
]
15+
16+
const router = new VueRouter({
17+
routes
18+
})
19+
20+
export default router

examples/src/views/base/index.vue

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<template>
2+
<div class="base">
3+
base
4+
</div>
5+
</template>
6+
<script>
7+
export default {
8+
name: 'Base'
9+
}
10+
</script>

0 commit comments

Comments
 (0)