chore(cli): update eslint config and prettier codes

This commit is contained in:
陈嘉涵
2020-01-19 11:42:22 +08:00
parent 633e9cf59d
commit 1691451813
52 changed files with 383 additions and 363 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
import DemoNav from './components/DemoNav';
export default {
components: { DemoNav }
components: { DemoNav },
};
</script>
@@ -10,8 +10,8 @@ export default {
name: 'demo-block',
props: {
title: String
}
title: String,
},
};
</script>
@@ -4,16 +4,14 @@
class="demo-home__title"
:class="{ 'demo-home__title--small': smallTitle }"
>
<img :src="config.logo">
<img :src="config.logo" />
<span>{{ config.title }}</span>
</h1>
<h2 v-if="config.description" class="demo-home__desc">{{ config.description }}</h2>
<h2 v-if="config.description" class="demo-home__desc">
{{ config.description }}
</h2>
<template v-for="(group, index) in config.nav">
<demo-home-nav
:group="group"
:lang="lang"
:key="index"
/>
<demo-home-nav :group="group" :lang="lang" :key="index" />
</template>
</div>
</template>
@@ -24,7 +22,7 @@ import DemoHomeNav from './DemoHomeNav';
export default {
components: {
DemoHomeNav
DemoHomeNav,
},
computed: {
@@ -45,8 +43,8 @@ export default {
smallTitle() {
return this.config.title.length >= 8;
}
}
},
},
};
</script>
@@ -20,25 +20,25 @@ import ArrowRight from './ArrowRight';
export default {
components: {
ArrowRight
ArrowRight,
},
props: {
lang: String,
group: Object
group: Object,
},
data() {
return {
active: []
active: [],
};
},
computed: {
base() {
return this.lang ? `/${this.lang}` : '';
}
}
},
},
};
</script>
@@ -13,7 +13,7 @@ export default {
data() {
return {
path:
'M296.114 508.035c-3.22-13.597.473-28.499 11.079-39.105l333.912-333.912c16.271-16.272 42.653-16.272 58.925 0s16.272 42.654 0 58.926L395.504 498.47l304.574 304.574c16.272 16.272 16.272 42.654 0 58.926s-42.654 16.272-58.926 0L307.241 528.058a41.472 41.472 0 0 1-11.127-20.023z'
'M296.114 508.035c-3.22-13.597.473-28.499 11.079-39.105l333.912-333.912c16.271-16.272 42.653-16.272 58.925 0s16.272 42.654 0 58.926L395.504 498.47l304.574 304.574c16.272 16.272 16.272 42.654 0 58.926s-42.654 16.272-58.926 0L307.241 528.058a41.472 41.472 0 0 1-11.127-20.023z',
};
},
@@ -21,14 +21,14 @@ export default {
title() {
const { name } = this.$route.meta || {};
return name ? name.replace(/-/g, '') : '';
}
},
},
methods: {
onBack() {
history.back();
}
}
},
},
};
</script>
@@ -18,8 +18,8 @@ export default {
}
return '';
}
}
},
},
};
</script>
+38 -27
View File
@@ -1,30 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><%= htmlWebpackPlugin.options.title %></title>
<meta name="description" content="<%= htmlWebpackPlugin.options.description %>" />
<link rel="icon" type="image/png" href="<%= htmlWebpackPlugin.options.logo %>" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover">
<meta http-Equiv="Cache-Control" Content="no-cache" />
<meta http-Equiv="Pragma" Content="no-cache" />
<meta http-Equiv="Expires" Content="0" />
<% if (htmlWebpackPlugin.options.baiduAnalytics) { %>
<script>
// avoid to load analytics in iframe
if (window.top === window) {
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?<%= htmlWebpackPlugin.options.baiduAnalytics.seed %>";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
}
</script>
<% } %>
</head>
<body ontouchstart>
<div id="app"></div>
</body>
<head>
<meta charset="UTF-8" />
<title><%= htmlWebpackPlugin.options.title %></title>
<meta
name="description"
content="<%= htmlWebpackPlugin.options.description %>"
/>
<link
rel="icon"
type="image/png"
href="<%= htmlWebpackPlugin.options.logo %>"
/>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"
/>
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<% if (htmlWebpackPlugin.options.baiduAnalytics) { %>
<script>
// avoid to load analytics in iframe
if (window.top === window) {
var _hmt = _hmt || [];
(function() {
var hm = document.createElement('script');
hm.src =
'https://hm.baidu.com/hm.js?<%= htmlWebpackPlugin.options.baiduAnalytics.seed %>';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(hm, s);
})();
}
</script>
<% } %>
</head>
<body ontouchstart>
<div id="app"></div>
</body>
</html>
+1 -1
View File
@@ -16,6 +16,6 @@ setTimeout(() => {
new Vue({
el: '#app',
render: h => h(App),
router
router,
});
}, 0);
+9 -9
View File
@@ -29,25 +29,25 @@ function getRoutes() {
if (langs.length) {
routes.push({
path: '*',
redirect: route => `/${getLangFromRoute(route)}/`
redirect: route => `/${getLangFromRoute(route)}/`,
});
langs.forEach(lang => {
routes.push({
path: `/${lang}`,
component: DemoHome,
meta: { lang }
meta: { lang },
});
});
} else {
routes.push({
path: '*',
redirect: () => '/'
redirect: () => '/',
});
routes.push({
path: '/',
component: DemoHome
component: DemoHome,
});
}
@@ -62,8 +62,8 @@ function getRoutes() {
component: demos[name],
meta: {
name,
lang
}
lang,
},
});
});
} else {
@@ -72,8 +72,8 @@ function getRoutes() {
path: `/${component}`,
component: demos[name],
meta: {
name
}
name,
},
});
}
});
@@ -86,7 +86,7 @@ Vue.use(VueRouter);
export const router = new VueRouter({
mode: 'hash',
routes: getRoutes(),
scrollBehavior: (to, from, savedPosition) => savedPosition || { x: 0, y: 0 }
scrollBehavior: (to, from, savedPosition) => savedPosition || { x: 0, y: 0 },
});
router.afterEach(() => {