ソースを参照

fix: site del backtop

richard1015 5 年 前
コミット
98c26811de

+ 5 - 5
lib/plugin/cli/site/doc/app.js

@@ -4,12 +4,12 @@ import Vue from 'vue';
 import App from './App.vue';
 import router from './router';
 import copy from 'clipboard';
-import backtop from './compents/backtop/backtop.js';
-import './compents/backtop/backtop.css';
-backtop.install(Vue);
+// import backtop from './compents/backtop/backtop.js';
+// import './compents/backtop/backtop.css';
+// backtop.install(Vue);
 import 'highlight.js/styles/github.css';
-import VueStickto from './compents/vue-stickto/VueStickto.js';
-Vue.use(VueStickto);
+// import VueStickto from './compents/vue-stickto/VueStickto.js';
+// Vue.use(VueStickto);
 import codes from 'qrcode';
 import { isMobile } from './asset/js/utils.js';
 

+ 1 - 1
lib/plugin/cli/site/doc/app.vue

@@ -108,7 +108,7 @@ export default {
 		let that = this;
 		let name = this.$route.name;
 		for (let i = 0, item; (item = packages[i]); i++) {
-			if (name == item.name) {
+			if (name == item.name.toLowerCase()) {
 				this.showPhone = true;
 			}
 		}

+ 0 - 29
lib/plugin/cli/site/doc/compents/backtop/backtop.css

@@ -1,29 +0,0 @@
-/*! NutUI2(2.0.2) - backtop.css, 4d177b46df0af221d246, 2019-01-25T10:47:27+08:00 */
-.nut-backtop {
-  display: none;
-  line-height: 0;
-  position: fixed;
-  cursor: pointer;
-  bottom: 20px;
-  right: 10px;
-  z-index: 1111; }
-  .nut-backtop.show {
-    display: block; }
-  .nut-backtop-main {
-    -webkit-transition: all .2s ease-in-out;
-    transition: all .2s ease-in-out;
-    width: 38px;
-    height: 38px;
-    background: #FFF url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 31 39'%3E%3Cg fill-rule='evenodd'%3E%3Cpath d='M1.41 0C.63 0 0 .672 0 1.5S.63 3 1.41 3h28.18C30.37 3 31 2.328 31 1.5S30.369 0 29.59 0H1.41zM17 7.5a1.5 1.5 0 0 0-3 0v30a1.5 1.5 0 1 0 3 0v-30zM8.44 12.44l-8 8a1.5 1.5 0 1 0 2.12 2.12l8-8a1.5 1.5 0 1 0-2.12-2.12z'/%3E%3Cpath d='M16.56 6.44l14 14a1.5 1.5 0 1 1-2.12 2.12l-14-14a1.5 1.5 0 1 1 2.12-2.12z'/%3E%3C/g%3E%3C/svg%3E") no-repeat center;
-    background-size: 20px 20px;
-    border-radius: 50%;
-    border: 2px solid rgba(180, 180, 180, 0.5);
-    box-shadow: 0px 0px 2px 3px rgba(220, 220, 220, 0.1); }
-  .nut-backtop i {
-    color: #fff;
-    font-size: 24px;
-    padding: 8px 12px;
-    line-height: 0; }
-
-
-/*# sourceMappingURL=backtop.css.map*/

ファイルの差分が大きいため隠しています
+ 0 - 1
lib/plugin/cli/site/doc/compents/backtop/backtop.css.map


ファイルの差分が大きいため隠しています
+ 0 - 1267
lib/plugin/cli/site/doc/compents/backtop/backtop.js


ファイルの差分が大きいため隠しています
+ 0 - 1
lib/plugin/cli/site/doc/compents/backtop/backtop.js.map


+ 0 - 30
lib/plugin/cli/site/doc/compents/backtop/backtop.scss

@@ -1,30 +0,0 @@
-.nut-backtop {
-	display: none;
-	line-height: 0;
-	position: fixed;
-	cursor: pointer;
-	bottom: 20px;
-	right: 10px;
-	z-index: 1111;
-	&.show {
-		display: block;
-	}
-	&-main {
-		transition: all 0.2s ease-in-out;
-		width: 38px;
-		height: 38px;
-		background: #fff
-			url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 31 39'%3E%3Cg fill-rule='evenodd'%3E%3Cpath d='M1.41 0C.63 0 0 .672 0 1.5S.63 3 1.41 3h28.18C30.37 3 31 2.328 31 1.5S30.369 0 29.59 0H1.41zM17 7.5a1.5 1.5 0 0 0-3 0v30a1.5 1.5 0 1 0 3 0v-30zM8.44 12.44l-8 8a1.5 1.5 0 1 0 2.12 2.12l8-8a1.5 1.5 0 1 0-2.12-2.12z'/%3E%3Cpath d='M16.56 6.44l14 14a1.5 1.5 0 1 1-2.12 2.12l-14-14a1.5 1.5 0 1 1 2.12-2.12z'/%3E%3C/g%3E%3C/svg%3E")
-			no-repeat center;
-		background-size: 20px 20px;
-		border-radius: 50%;
-		border: 2px solid rgba(180, 180, 180, 0.5);
-		box-shadow: 0px 0px 2px 3px rgba(220, 220, 220, 0.1);
-	}
-	i {
-		color: #fff;
-		font-size: 24px;
-		padding: 8px 12px;
-		line-height: 0;
-	}
-}

+ 0 - 113
lib/plugin/cli/site/doc/compents/backtop/backtop.vue

@@ -1,113 +0,0 @@
-<template>
-	<div :class="['nut-backtop', { show: backTop }]" :style="styles" @click="goto">
-		<slot>
-			<div class="nut-backtop-main"></div>
-		</slot>
-	</div>
-</template>
-<script>
-export default {
-	name: 'nut-backtop',
-	props: {
-		distance: {
-			type: Number,
-			default: 200,
-		},
-		bottom: {
-			type: Number,
-			default: 20,
-		},
-		right: {
-			type: Number,
-			default: 10,
-		},
-		duration: {
-			type: Number,
-			default: 1000,
-		},
-		zIndex: {
-			type: Number,
-			default: 1111,
-		},
-	},
-	data() {
-		return {
-			backTop: false,
-		};
-	},
-	mounted() {
-		window.addEventListener('scroll', this.handleScroll, false);
-		window.addEventListener('resize', this.handleScroll, false);
-	},
-	beforeDestroy() {
-		window.removeEventListener('scroll', this.handleScroll, false);
-		window.removeEventListener('resize', this.handleScroll, false);
-	},
-	computed: {
-		styles() {
-			return {
-				bottom: `${this.bottom}px`,
-				right: `${this.right}px`,
-				'z-index': this.zIndex,
-			};
-		},
-	},
-	methods: {
-		handleScroll() {
-			this.backTop = window.pageYOffset >= this.distance;
-		},
-		goto() {
-			const sTop = document.documentElement.scrollTop || document.body.scrollTop;
-			this.scrollTop(window, sTop, 0, this.duration);
-			this.$emit('click');
-		},
-		scrollTop(el, from = 0, to, duration = 500, endCallback) {
-			this.el = el;
-			let lastTime = 0;
-			let vendors = ['webkit', 'moz'];
-			for (let x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
-				window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
-				window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame'];
-			}
-
-			if (!window.requestAnimationFrame) {
-				window.requestAnimationFrame = function (callback, element) {
-					let currTime = new Date().getTime();
-					let timeToCall = Math.max(0, 16.7 - (currTime - lastTime));
-					let id = window.setTimeout(function () {
-						callback(currTime + timeToCall);
-					}, timeToCall);
-					lastTime = currTime + timeToCall;
-					return id;
-				};
-			}
-			if (!window.cancelAnimationFrame) {
-				window.cancelAnimationFrame = function (id) {
-					clearTimeout(id);
-				};
-			}
-			const difference = Math.abs(from - to);
-			const step = Math.ceil((difference / duration) * 50);
-
-			this.scroll(from, to, step, endCallback);
-		},
-		scroll(start, end, step, endCallback) {
-			if (start === end) {
-				endCallback && endCallback();
-				return;
-			}
-
-			let d = start + step > end ? end : start + step;
-			if (start > end) {
-				d = start - step < end ? end : start - step;
-			}
-			if (this.el === window) {
-				window.scrollTo(d, d);
-			} else {
-				this.el.scrollTop = d;
-			}
-			window.requestAnimationFrame(() => this.scroll(d, end, step));
-		},
-	},
-};
-</script>

+ 0 - 8
lib/plugin/cli/site/doc/compents/backtop/index.js

@@ -1,8 +0,0 @@
-import BackTop from './backtop.vue';
-import './backtop.scss';
-
-BackTop.install = function(Vue) {
-  Vue.component(BackTop.name, BackTop);
-};
-
-export default BackTop

+ 7 - 7
lib/plugin/cli/site/doc/search.vue

@@ -4,7 +4,7 @@
 		<!-- <transition name="fade"> -->
 		<ul class="search-list" v-if="searchList.length > 0">
 			<li :class="searchCurName == item.name ? 'cur' : ''" @click="checklist(item)" v-for="(item, index) in searchList" :key="index">
-				<router-link :to="{ name: item.name }">
+				<router-link :to="{ name: item.name.toLowerCase() }">
 					{{ item.name }}
 					<span>{{ item.chnName }}</span>
 				</router-link>
@@ -22,13 +22,13 @@ export default {
 			searchVal: '',
 			searchList: [],
 			searchCurName: '',
-			searchIndex: 0,
+			searchIndex: 0
 		};
 	},
 	watch: {
 		searchVal(sVal) {
 			if (sVal) {
-				this.searchList = this.packages.filter((item) => {
+				this.searchList = this.packages.filter(item => {
 					if (item.showDemo === false) return false;
 					const rx = new RegExp(sVal, 'gi');
 					return rx.test(item.name + ' ' + item.chnName + '' + item.desc);
@@ -38,7 +38,7 @@ export default {
 				this.searchIndex = 0;
 				this.searchList = [];
 			}
-		},
+		}
 	},
 	mounted() {
 		document.documentElement.addEventListener('click', this.closelist);
@@ -77,7 +77,7 @@ export default {
 					this.searchIndex = searchIndex;
 					if (e.keyCode == 13) {
 						this.$router.push({
-							path: '/' + searchList[searchIndex].name,
+							path: '/' + searchList[searchIndex].name
 						});
 						this.searchCurName = '';
 						this.searchIndex = 0;
@@ -85,8 +85,8 @@ export default {
 					}
 				}
 			}
-		},
-	},
+		}
+	}
 };
 </script>
 <style lang="scss" scoped>

+ 1 - 1
lib/plugin/markdown-to-vue/mdToVue.js

@@ -192,7 +192,7 @@ class mdVue {
                                 </div>` +
 				param.html +
 				(_that.options.hasMarkList ? '<ul class="markList">' + _that.Articlehead + '</ul>' : '') +
-				`<nut-backtop :right="50" :bottom="50"></nut-backtop>
+				`
                                 </div>
                             </template><script>import root from '../root.js';
             export default {