@@ -38,13 +38,25 @@ export default {
return [];
}
},
- base: String
+ base: String,
+ navKey: [String, Number]
},
data() {
return {
isOpen: false
};
+ },
+
+ mounted() {
+ this.isOpen = JSON.parse(sessionStorage.getItem('mobile-nav-' + this.navKey));
+ },
+
+ methods: {
+ handleNavTitleClick() {
+ this.isOpen = !this.isOpen;
+ sessionStorage.setItem('mobile-nav-' + this.navKey, this.isOpen);
+ }
}
};
diff --git a/docs/src/examples.js b/docs/src/examples.js
index 48e109433..716e7c8b2 100644
--- a/docs/src/examples.js
+++ b/docs/src/examples.js
@@ -15,24 +15,18 @@ Vue.use(ZanUI.Lazyload, {
});
Vue.use(VueRouter);
-const isProduction = process.env.NODE_ENV === 'production';
const routesConfig = routes(navConfig, true);
routesConfig.push({
path: '/',
component: DemoList.default || DemoList
});
const router = new VueRouter({
- mode: 'hash',
- base: isProduction ? '/zanui/vue/' : __dirname,
+ mode: 'history',
+ base: '/zanui/vue/examples',
routes: routesConfig
});
-
-router.beforeEach((route, redirect, next) => {
- if (route.path !== '/') {
- window.scrollTo(0, 0);
- }
- document.title = route.meta.title || document.title;
- next();
+router.afterEach((route, redirect, next) => {
+ document.querySelector('.examples-container').scrollTop = 0;
});
new Vue({ // eslint-disable-line
diff --git a/docs/src/index.js b/docs/src/index.js
index c231831b2..14d173937 100644
--- a/docs/src/index.js
+++ b/docs/src/index.js
@@ -6,7 +6,6 @@ import routes from './router.config';
import ZanUI from 'src/index.js';
import packageJson from '../../package.json';
-const isProduction = process.env.NODE_ENV === 'production';
const global = {
version: packageJson.version
};
@@ -35,7 +34,7 @@ routesConfig.push({
const router = new VueRouter({
mode: 'history',
- base: isProduction ? '/zanui/vue/' : __dirname,
+ base: '/zanui/vue/',
routes: routesConfig
});
@@ -44,7 +43,7 @@ router.beforeEach((route, redirect, next) => {
window.scrollTo(0, 0);
}
- const pathname = isProduction ? '/vue/examples' : '/examples.html';
+ const pathname = '/zanui/vue/examples';
if (isMobile()) {
window.location.replace(pathname);
return;
diff --git a/package.json b/package.json
index 426f1704c..b260ff893 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,7 @@
],
"scripts": {
"bootstrap": "yarn || npm i --registry=http://registry.npm.qima-inc.com",
- "dev": "npm run build:file && webpack-dev-server --inline --history-api-fallback --hot --config build/webpack.config.js --content-base ./",
+ "dev": "npm run build:file && webpack-dev-server --inline --hot --config build/webpack.config.js --content-base ./",
"build:file": "node build/bin/build-entry.js",
"build:utils": "cross-env BABEL_ENV=utils babel src --out-dir lib --ignore src/index.js",
"build:vant-css": "gulp build --gulpfile packages/vant-css/gulpfile.js && cp-cli packages/vant-css/lib lib/vant-css",
diff --git a/packages/loading/src/loading.vue b/packages/loading/src/loading.vue
index ec5223ed0..64fb16f73 100644
--- a/packages/loading/src/loading.vue
+++ b/packages/loading/src/loading.vue
@@ -1,5 +1,5 @@
-
+
diff --git a/packages/swipe/src/scroll.js b/packages/swipe/src/scroll.js
index 8d6b46a15..d70b1aba1 100755
--- a/packages/swipe/src/scroll.js
+++ b/packages/swipe/src/scroll.js
@@ -48,9 +48,7 @@ extend(Scroll.prototype, {
top: 0,
left: 0,
width: '100%',
- height: '100%',
- '-webkit-transform': 'translate3d(-9999px, 0, 0)',
- 'pointer-events': 'none'
+ height: '100%'
};
setElementsStyles(this.pages, defaultStyle);
this.mCache = {
diff --git a/packages/vant-css/src/actionsheet.css b/packages/vant-css/src/actionsheet.css
index 8b73ae279..71699c283 100644
--- a/packages/vant-css/src/actionsheet.css
+++ b/packages/vant-css/src/actionsheet.css
@@ -21,16 +21,13 @@
@e item {
line-height: 50px;
+ height: 50px;
text-align: center;
color: $c-black;
font-size: 16px;
position: relative;
background-color: $c-white;
- @m loading {
- padding: 10px 0;
- }
-
&::after {
@mixin border-retina (top);
}
@@ -43,6 +40,7 @@
@e loading {
margin: 0 auto;
+ display: inline-block;
}
@e button {
diff --git a/packages/vant-css/src/dialog.css b/packages/vant-css/src/dialog.css
index 0523ec2ff..d085f7d51 100644
--- a/packages/vant-css/src/dialog.css
+++ b/packages/vant-css/src/dialog.css
@@ -71,8 +71,9 @@
@e btn {
font-size: 16px;
- line-height: 40px;
+ line-height: 52px;
border: 0;
+ padding: 0;
background-color: #fff;
float: left;
box-sizing: border-box;
diff --git a/packages/vant-css/src/loading.css b/packages/vant-css/src/loading.css
index 6db1123ff..be61983ba 100644
--- a/packages/vant-css/src/loading.css
+++ b/packages/vant-css/src/loading.css
@@ -24,10 +24,20 @@
@component-namespace van {
@b loading {
- width: 30px;
- height: 30px;
+
line-height: 0;
font-size: 0;
+
+ @m circle {
+ width: 16px;
+ height: 16px;
+ vertical-align: middle;
+ }
+
+ @m gradient-circle {
+ width: 30px;
+ height: 30px;
+ }
@e spinner {
display: inline-block;
diff --git a/packages/vant-css/src/search.css b/packages/vant-css/src/search.css
index 5cd27016b..5a0c9e5b2 100644
--- a/packages/vant-css/src/search.css
+++ b/packages/vant-css/src/search.css
@@ -28,6 +28,7 @@
color: $c-gray-dark;
border: none;
outline: none;
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
@e cancel {
@@ -51,10 +52,11 @@
.van-icon-clear {
font-size: 14px;
- line-height: 1;
+ line-height: 16px;
position: absolute;
right: 5px;
- top: 9px;
+ top: 50%;
+ transform: translateY(-50%);
color: #888;
}
}
diff --git a/packages/vant-css/src/switch.css b/packages/vant-css/src/switch.css
index fc827ef9b..346bc03e5 100644
--- a/packages/vant-css/src/switch.css
+++ b/packages/vant-css/src/switch.css
@@ -37,6 +37,7 @@
left: 50%;
top: 50%;
transform: translate3d(-50%, -50%, 0);
+ margin: 0;
}
@m on {