mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-23 18:00:27 +08:00
Merge branch 'master' of gitlab.qima-inc.com:fe/zanui-vue
This commit is contained in:
commit
7bbb53e5f5
@ -35,8 +35,8 @@ function wrap(render) {
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
entry: {
|
entry: {
|
||||||
'vendor': ['vue', 'vue-router'],
|
'vendor': ['vue', 'vue-router'],
|
||||||
'docs': './docs/index.js',
|
'zan-docs': './docs/index.js',
|
||||||
'examples': './docs/examples.js'
|
'zan-examples': './docs/examples.js'
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
path: path.join(__dirname, '../docs/dist'),
|
path: path.join(__dirname, '../docs/dist'),
|
||||||
@ -100,13 +100,13 @@ module.exports = {
|
|||||||
StyleExtractPlugin,
|
StyleExtractPlugin,
|
||||||
new ProgressBarPlugin(),
|
new ProgressBarPlugin(),
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
chunks: ['vendor', 'docs'],
|
chunks: ['vendor', 'zan-docs'],
|
||||||
template: 'docs/index.tpl',
|
template: 'docs/index.tpl',
|
||||||
filename: 'index.html',
|
filename: 'index.html',
|
||||||
inject: true
|
inject: true
|
||||||
}),
|
}),
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
chunks: ['vendor', 'examples'],
|
chunks: ['vendor', 'zan-examples'],
|
||||||
template: 'docs/index.tpl',
|
template: 'docs/index.tpl',
|
||||||
filename: 'examples.html',
|
filename: 'examples.html',
|
||||||
inject: true
|
inject: true
|
||||||
@ -168,7 +168,7 @@ if (process.env.NODE_ENV === 'production') {
|
|||||||
delete module.exports.devtool;
|
delete module.exports.devtool;
|
||||||
module.exports.output = {
|
module.exports.output = {
|
||||||
path: path.join(__dirname, '../docs/dist'),
|
path: path.join(__dirname, '../docs/dist'),
|
||||||
publicPath: './',
|
publicPath: '/vue',
|
||||||
filename: '[name].[hash:8].js'
|
filename: '[name].[hash:8].js'
|
||||||
};
|
};
|
||||||
module.exports.plugins = module.exports.plugins.concat([
|
module.exports.plugins = module.exports.plugins.concat([
|
||||||
|
@ -53,13 +53,6 @@
|
|||||||
</zan-col>
|
</zan-col>
|
||||||
</zan-row>
|
</zan-row>
|
||||||
|
|
||||||
</example-block><example-block title="button group">
|
|
||||||
<div class="button-group">
|
|
||||||
<zan-button type="primary" size="small">确认付款</zan-button>
|
|
||||||
<zan-button size="small">确认收货</zan-button>
|
|
||||||
<zan-button size="small">取消订单</zan-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</example-block></section></template>
|
</example-block></section></template>
|
||||||
<style>
|
<style>
|
||||||
@component-namespace demo {
|
@component-namespace demo {
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
</zan-swipe>
|
</zan-swipe>
|
||||||
|
|
||||||
</example-block><example-block title="自动轮播">
|
</example-block><example-block title="自动轮播">
|
||||||
<zan-swipe :auto-play="true">
|
<zan-swipe :auto-play="true" @pagechange:end="handlePageEnd">
|
||||||
<zan-swipe-item>
|
<zan-swipe-item>
|
||||||
<img src="https://img.yzcdn.cn/upload_files/2017/03/14/FmTPs0SeyQaAOSK1rRe1sL8RcwSY.jpeg?imageView2/2/w/980/h/980/q/75/format/webp" alt="">
|
<img src="https://img.yzcdn.cn/upload_files/2017/03/14/FmTPs0SeyQaAOSK1rRe1sL8RcwSY.jpeg?imageView2/2/w/980/h/980/q/75/format/webp" alt="">
|
||||||
</zan-swipe-item>
|
</zan-swipe-item>
|
||||||
@ -33,4 +33,12 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
import Vue from "vue";import ExampleBlock from "../components/example-block";Vue.component("example-block", ExampleBlock);</script>
|
import Vue from "vue";import ExampleBlock from "../components/example-block";Vue.component("example-block", ExampleBlock);
|
||||||
|
export default {
|
||||||
|
methods: {
|
||||||
|
handlePageEnd(page, index) {
|
||||||
|
console.log(page, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -40,6 +40,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="demo-progress__wrapper">
|
<div class="demo-progress__wrapper">
|
||||||
<zan-progress class="demo-progress__demo1" :inactive="true" :percentage="100"></zan-progress>
|
<zan-progress class="demo-progress__demo1" :inactive="true" :percentage="100"></zan-progress>
|
||||||
|
</div>
|
||||||
```
|
```
|
||||||
:::
|
:::
|
||||||
|
|
||||||
@ -47,7 +48,6 @@
|
|||||||
### 自定义颜色和文字
|
### 自定义颜色和文字
|
||||||
:::demo 自定义颜色
|
:::demo 自定义颜色
|
||||||
```html
|
```html
|
||||||
</div>
|
|
||||||
<div class="demo-progress__wrapper">
|
<div class="demo-progress__wrapper">
|
||||||
<zan-progress class="demo-progress__demo1" pivot-text="红色" color="#ed5050" :percentage="26"></zan-progress>
|
<zan-progress class="demo-progress__demo1" pivot-text="红色" color="#ed5050" :percentage="26"></zan-progress>
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,6 +12,16 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
methods: {
|
||||||
|
handlePageEnd(page, index) {
|
||||||
|
console.log(page, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
## Swipe 轮播
|
## Swipe 轮播
|
||||||
|
|
||||||
### 基础用法
|
### 基础用法
|
||||||
@ -33,7 +43,7 @@
|
|||||||
|
|
||||||
:::demo 自动轮播
|
:::demo 自动轮播
|
||||||
```html
|
```html
|
||||||
<zan-swipe :auto-play="true">
|
<zan-swipe :auto-play="true" @pagechange:end="handlePageEnd">
|
||||||
<zan-swipe-item>
|
<zan-swipe-item>
|
||||||
<img src="https://img.yzcdn.cn/upload_files/2017/03/14/FmTPs0SeyQaAOSK1rRe1sL8RcwSY.jpeg?imageView2/2/w/980/h/980/q/75/format/webp" alt="">
|
<img src="https://img.yzcdn.cn/upload_files/2017/03/14/FmTPs0SeyQaAOSK1rRe1sL8RcwSY.jpeg?imageView2/2/w/980/h/980/q/75/format/webp" alt="">
|
||||||
</zan-swipe-item>
|
</zan-swipe-item>
|
||||||
@ -43,3 +53,16 @@
|
|||||||
</zan-swipe>
|
</zan-swipe>
|
||||||
```
|
```
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
||||||
|
|-----------|-----------|-----------|-------------|-------------|
|
||||||
|
| autoPlay | 是否自动轮播 | `boolean` | `false` | `true`, `false` |
|
||||||
|
| showIndicators | 是否显示指示器 | `boolean` | `true` | `true`, `false` |
|
||||||
|
|
||||||
|
### 事件
|
||||||
|
|
||||||
|
| 事件名 | 说明 | 参数 |
|
||||||
|
|-----------|-----------|-----------|
|
||||||
|
| `pagechange:end` | 每一页轮播结束后触发 | `(elem, currIndex)`:`elem`为触发页当前的DOM节点 |
|
||||||
|
@ -25,7 +25,7 @@ Vue.component('footer-nav', FooterNav);
|
|||||||
let routesConfig = routes(navConfig);
|
let routesConfig = routes(navConfig);
|
||||||
routesConfig.push({
|
routesConfig.push({
|
||||||
path: '/',
|
path: '/',
|
||||||
redirect: '/component/button'
|
redirect: '/component/install'
|
||||||
});
|
});
|
||||||
|
|
||||||
const router = new VueRouter({
|
const router = new VueRouter({
|
||||||
@ -38,8 +38,10 @@ router.beforeEach((route, redirect, next) => {
|
|||||||
if (route.path !== '/') {
|
if (route.path !== '/') {
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const pathname = process.env.NODE_ENV === 'production' ? '/vue/' : '/';
|
||||||
if (isMobile()) {
|
if (isMobile()) {
|
||||||
window.location.replace(location.pathname + 'examples.html#' + route.path);
|
window.location.replace(pathname + 'examples.html#/');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
document.title = route.meta.title || document.title;
|
document.title = route.meta.title || document.title;
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'zan-swipe-item'
|
name: 'zan-swipe-item',
|
||||||
|
|
||||||
|
beforeCreate() {
|
||||||
|
this.$parent.swipes.push(this);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,7 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="zan-swipe">
|
<div class="zan-swipe">
|
||||||
|
<div class="zan-swipe__items">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="zan-swipe__indicators" v-if="showIndicators">
|
||||||
|
<span class="zan-swipe__indicator" v-for="i in swipes.length" :class="{
|
||||||
|
'zan-swipe__indicator--active': currIndex === i -1
|
||||||
|
}">
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -13,16 +21,20 @@ export default {
|
|||||||
name: 'zan-swipe',
|
name: 'zan-swipe',
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
autoPlay: {
|
autoPlay: Boolean,
|
||||||
|
showIndicators: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: true
|
||||||
},
|
|
||||||
onPageChangeEnd: {
|
|
||||||
type: Function,
|
|
||||||
default: () => {}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
currIndex: 0,
|
||||||
|
swipes: []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.input = new Input(this.$el, {
|
this.input = new Input(this.$el, {
|
||||||
listenMoving: true
|
listenMoving: true
|
||||||
@ -53,6 +65,13 @@ export default {
|
|||||||
|
|
||||||
updated() {
|
updated() {
|
||||||
this.scroll.update();
|
this.scroll.update();
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
onPageChangeEnd(page, currIndex) {
|
||||||
|
this.currIndex = +currIndex;
|
||||||
|
this.$emit('pagechange:end', page, currIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,15 +1,47 @@
|
|||||||
|
@import './common/var.css';
|
||||||
|
|
||||||
@component-namespace zan {
|
@component-namespace zan {
|
||||||
@b swipe {
|
@b swipe {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
@e indicators {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 10px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
@e indicator {
|
||||||
|
width: 5px;
|
||||||
|
height: 5px;
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: 100%;
|
||||||
|
background: #999;
|
||||||
|
opacity: .8;
|
||||||
|
margin: 0 3px;
|
||||||
|
z-index: 1;
|
||||||
|
|
||||||
|
@m active {
|
||||||
|
background: $c-orange;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@e items {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@b swipe-item {
|
@b swipe-item {
|
||||||
display: none;
|
display: none;
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user