[improvement] update eslint config (#2288)

This commit is contained in:
neverland 2018-12-14 14:24:23 +08:00 committed by GitHub
parent d2751ffdfa
commit 16e4889a92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
141 changed files with 6387 additions and 7536 deletions

View File

@ -1,22 +1,4 @@
{
"root": true,
"env": {
"jest": true
},
"extends": ["plugin:vue-libs/recommended", "plugin:vue/recommended"],
"rules": {
"semi": ["error", "always"],
"space-before-function-paren": ["error", "never"],
"vue/attributes-order": 0,
"vue/require-v-for-key": 0,
"vue/require-default-prop": 0,
"vue/name-property-casing": ["error", "kebab-case"],
"vue/html-closing-bracket-newline": [
"error",
{
"singleline": "never",
"multiline": "always"
}
]
}
"extends": ["@vant"]
}

View File

@ -1,4 +1,4 @@
module.exports = function(api) {
module.exports = function (api) {
const { BABEL_MODULE, NODE_ENV } = process.env;
const useESModules = BABEL_MODULE !== 'commonjs' && NODE_ENV !== 'test';

View File

@ -3,8 +3,11 @@ const glob = require('fast-glob');
const path = require('path');
const uppercamelize = require('uppercamelcase');
const Components = require('./get-components')();
const version = process.env.VERSION || require('../package.json').version;
const tips = '// This file is auto gererated by build/build-entry.js';
const packageJson = require('../package.json');
const version = process.env.VERSION || packageJson.version;
const tips = `/* eslint-disable */
// This file is auto gererated by build/build-entry.js`;
const root = path.join(__dirname, '../');
const join = dir => path.join(root, dir);

View File

@ -3,6 +3,7 @@
*/
const shell = require('shelljs');
const signale = require('signale');
const { Signale } = signale;
const tasks = [
'bootstrap',

View File

@ -1,11 +1,13 @@
/* eslint-disable no-use-before-define */
/**
* Build style entry of all components
*/
const fs = require('fs-extra');
const path = require('path');
const components = require('./get-components')();
const dependencyTree = require('dependency-tree');
const components = require('./get-components')();
const whiteList = [
'info',
'icon',
@ -17,17 +19,10 @@ const whiteList = [
];
const dir = path.join(__dirname, '../es');
components.forEach(component => {
// css entry
destEntryFile(component, 'index.js', '.css');
// less entry
destEntryFile(component, 'less.js', '.less');
});
function destEntryFile(component, filename, ext = '') {
const deps = analyzeDependencies(component).map(dep =>
const deps = analyzeDependencies(component).map(dep => (
getStyleRelativePath(component, dep, ext)
);
));
const esEntry = path.join(dir, component, `style/${filename}`);
const libEntry = path.join(
@ -68,12 +63,12 @@ function search(tree, component, checkList) {
Object.keys(tree).forEach(key => {
search(tree[key], component, checkList);
components
.filter(item =>
.filter(item => (
key
.replace(dir, '')
.split('/')
.includes(item)
)
))
.forEach(item => {
if (
!checkList.includes(item) &&
@ -103,3 +98,10 @@ function getStyleRelativePath(component, style, ext) {
function checkComponentHasStyle(component) {
return fs.existsSync(getStylePath(component));
}
components.forEach(component => {
// css entry
destEntryFile(component, 'index.js', '.css');
// less entry
destEntryFile(component, 'less.js', '.less');
});

View File

@ -4,13 +4,13 @@ const csso = require('gulp-csso');
const postcss = require('gulp-postcss');
// compile component css
gulp.task('compile', () => {
return gulp
gulp.task('compile', () => (
gulp
.src(['../es/**/*.less', '../lib/**/*.less'])
.pipe(less())
.pipe(postcss())
.pipe(csso())
.pipe(gulp.dest(file => file.base.replace('.less', '.css')));
});
.pipe(gulp.dest(file => file.base.replace('.less', '.css')))
));
gulp.task('default', ['compile']);

View File

@ -10,7 +10,7 @@ const excludes = [
'.DS_Store'
];
module.exports = function() {
module.exports = function () {
const dirs = fs.readdirSync(path.resolve(__dirname, '../packages'));
return dirs.filter(dirName => excludes.indexOf(dirName) === -1);
};

View File

@ -1,5 +1,6 @@
const path = require('path');
const config = require('./webpack.dev.js');
const isMinify = process.argv.indexOf('-p') !== -1;
delete config.serve;
@ -7,7 +8,7 @@ delete config.serve;
module.exports = Object.assign(config, {
mode: 'production',
entry: {
'vant': './es/index.js'
vant: './es/index.js'
},
output: {
path: path.join(__dirname, '../lib'),

View File

@ -3,11 +3,10 @@
*/
import Vue from 'vue';
import i18n from '../../packages/mixins/i18n';
import Vant, { Lazyload } from '../../packages';
import VantDoc, { DemoBlock, DemoSection } from 'vant-doc';
import VueRouter from 'vue-router';
import { Locale } from '../../packages';
import VantDoc, { DemoBlock, DemoSection } from 'vant-doc';
import i18n from '../../packages/mixins/i18n';
import Vant, { Lazyload, Locale } from '../../packages';
import { camelize } from '../../packages/utils';
Vue
@ -86,12 +85,12 @@ export function wrapper(promise, name) {
component = component.default;
name = 'demo-' + name;
component.name = name;
const { i18n } = component;
if (i18n) {
const { i18n: config } = component;
if (config) {
const formattedI18n = {};
const camelizedName = camelize(name);
Object.keys(i18n).forEach(key => {
formattedI18n[key] = { [camelizedName]: i18n[key] };
Object.keys(config).forEach(key => {
formattedI18n[key] = { [camelizedName]: config[key] };
});
Locale.add(formattedI18n);
}

View File

@ -1,3 +1,4 @@
/* eslint-disable */
// This file is auto gererated by build/build-entry.js
import { wrapper } from './demo-common';

View File

@ -1,3 +1,4 @@
/* eslint-disable */
// This file is auto gererated by build/build-entry.js
export default {
'changelog.en-US': () => import('../markdown/changelog.en-US.md'),

View File

@ -1,8 +1,8 @@
import Vue from 'vue';
import VueRouter from 'vue-router';
import VantDoc, { progress } from 'vant-doc';
import App from './DocsApp';
import routes from './router';
import VantDoc, { progress } from 'vant-doc';
import { isMobile } from './utils';
Vue.use(VueRouter).use(VantDoc);
@ -33,8 +33,8 @@ if (process.env.NODE_ENV !== 'production') {
Vue.config.productionTip = false;
}
new Vue({ // eslint-disable-line
new Vue({
el: '#app',
render: h => h(App),
router,
el: '#app'
router
});

View File

@ -1,9 +1,9 @@
import '../../packages/index.less';
import Vue from 'vue';
import VueRouter from 'vue-router';
import { progress } from 'vant-doc';
import App from './WapApp';
import routes from './router';
import { progress } from 'vant-doc';
import 'vant-doc/helper/touch-simulator';
const router = new VueRouter({
@ -32,7 +32,7 @@ if (process.env.NODE_ENV !== 'production') {
Vue.config.productionTip = false;
}
new Vue({ // eslint-disable-line
new Vue({
el: '#app',
render: h => h(App),
router

View File

@ -9,10 +9,10 @@ import './utils/iframe-router';
const registerRoute = (isDemo) => {
const route = [{
path: '*',
redirect: to => `/${Vue.prototype.$vantLang}/`
redirect: () => `/${Vue.prototype.$vantLang}/`
}];
Object.keys(docConfig).forEach((lang, index) => {
Object.keys(docConfig).forEach((lang) => {
if (isDemo) {
route.push({
path: `/${lang}`,
@ -26,17 +26,6 @@ const registerRoute = (isDemo) => {
});
}
const navs = docConfig[lang].nav || [];
navs.forEach(nav => {
if (nav.groups) {
nav.groups.forEach(group => {
group.list.forEach(page => addRoute(page, lang));
});
} else {
addRoute(nav, lang);
}
});
function addRoute(page, lang) {
let { path } = page;
if (path) {
@ -65,6 +54,17 @@ const registerRoute = (isDemo) => {
});
}
}
const navs = docConfig[lang].nav || [];
navs.forEach(nav => {
if (nav.groups) {
nav.groups.forEach(group => {
group.list.forEach(page => addRoute(page, lang));
});
} else {
addRoute(nav, lang);
}
});
});
return route;

View File

@ -3,9 +3,9 @@
*/
import { setLang } from './lang';
import { iframeReady, isMobile } from './';
import { iframeReady, isMobile } from '.';
window.syncPath = function(dir) {
window.syncPath = function () {
const router = window.vueRouter;
const isInIframe = window !== window.top;
const currentDir = router.history.current.path;
@ -28,7 +28,7 @@ window.syncPath = function(dir) {
}
};
window.changePath = function(lang, path = '') {
window.changePath = function (lang, path = '') {
setLang(lang);
window.vueRouter.replace(path);
};

View File

@ -14,11 +14,9 @@ const langMap = {
};
let currentLang = '';
setLang(getDefaultLang());
function getDefaultLang() {
const langs = Object.keys(langMap);
const hash = location.hash;
const { hash } = location;
for (let i = 0; i < langs.length; i++) {
if (hash.indexOf(langs[i]) !== -1) {
@ -42,3 +40,5 @@ export function setLang(lang) {
Locale.use(lang, langMap[lang].messages);
document.title = langMap[lang].title;
}
setLang(getDefaultLang());

View File

@ -72,6 +72,7 @@
"@babel/plugin-transform-runtime": "^7.1.0",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.1.6",
"@vant/eslint-config": "^1.0.6",
"@vue/server-test-utils": "^1.0.0-beta.26",
"@vue/test-utils": "^1.0.0-beta.26",
"autoprefixer": "^9.3.1",
@ -80,21 +81,20 @@
"babel-loader": "^8.0.4",
"codecov": "^3.1.0",
"cross-env": "^5.2.0",
"css-loader": "^1.0.1",
"css-loader": "^2.0.0",
"dependency-tree": "^6.3.0",
"eslint": "^5.9.0",
"eslint-plugin-vue-libs": "^3.0.0",
"fast-glob": "^2.2.4",
"fast-vue-md-loader": "^1.0.3",
"gh-pages": "^2.0.1",
"gulp": "^3.9.1",
"gulp": "^4.0.0",
"gulp-csso": "^3.0.1",
"gulp-iconfont": "^10.0.2",
"gulp-iconfont-css": "^2.3.0",
"gulp-less": "^4.0.1",
"gulp-postcss": "^8.0.0",
"html-webpack-plugin": "3.2.0",
"husky": "^1.2.0",
"husky": "^1.2.1",
"jest": "^23.6.0",
"jest-serializer-vue": "^2.0.2",
"less": "^3.8.1",
@ -114,13 +114,13 @@
"uppercamelcase": "^3.0.0",
"url-loader": "^1.1.2",
"vant-doc": "1.0.20",
"vue": "2.5.17",
"vue": "2.5.21",
"vue-jest": "^3.0.1",
"vue-loader": "^15.4.2",
"vue-router": "^3.0.2",
"vue-server-renderer": "^2.5.17",
"vue-sfc-compiler": "^0.1.3",
"vue-template-compiler": "2.5.17",
"vue-template-compiler": "2.5.21",
"vue-template-es2015-compiler": "^1.6.0",
"webpack": "^4.26.1",
"webpack-cli": "^3.1.2",

View File

@ -22,7 +22,11 @@
>
<li
v-for="item in actions"
:class="[b('item', { disabled: item.disabled || item.loading }), item.className, 'van-hairline--top']"
:class="[
b('item', { disabled: item.disabled || item.loading }),
item.className,
'van-hairline--top'
]"
@click.stop="onSelect(item)"
>
<template v-if="!item.loading">
@ -84,7 +88,10 @@ export default create({
methods: {
onSelect(item) {
if (!item.disabled && !item.loading) {
item.callback && item.callback(item);
if (item.callback) {
item.callback(item);
}
this.$emit('select', item);
}
},

View File

@ -2,16 +2,13 @@
exports[`renders demo correctly 1`] = `
<div>
<div>
<button class="van-button van-button--default van-button--normal"><span class="van-button__text">弹出 Actionsheet</span></button>
<div><button class="van-button van-button--default van-button--normal"><span class="van-button__text">弹出 Actionsheet</span></button>
<!---->
</div>
<div>
<button class="van-button van-button--default van-button--normal"><span class="van-button__text">弹出带取消按钮的 Actionsheet</span></button>
<div><button class="van-button van-button--default van-button--normal"><span class="van-button__text">弹出带取消按钮的 Actionsheet</span></button>
<!---->
</div>
<div>
<button class="van-button van-button--default van-button--normal"><span class="van-button__text">弹出带标题的 Actionsheet</span></button>
<div><button class="van-button van-button--default van-button--normal"><span class="van-button__text">弹出带标题的 Actionsheet</span></button>
<!---->
</div>
</div>

View File

@ -1,5 +1,5 @@
import { mount } from '../../../test/utils';
import Actionsheet from '../';
import Actionsheet from '..';
test('callback events', () => {
const callback = jest.fn();

View File

@ -63,7 +63,7 @@ export default create({
searchList() {
if (this.showSearchResult && this.focused) {
return this.searchResult || [];
};
}
return [];
},

View File

@ -245,7 +245,7 @@ export default create({
this.$emit('change-area', values);
},
assignAreaValues(values) {
assignAreaValues() {
const { area } = this.$refs;
if (area) {
const detail = area.getArea();
@ -321,7 +321,10 @@ export default create({
// set area code to area component
setAreaCode(code) {
this.data.areaCode = code || '';
code && this.$nextTick(this.assignAreaValues);
if (code) {
this.$nextTick(this.assignAreaValues);
}
},
setAddressDetail(value) {

View File

@ -10,8 +10,7 @@ exports[`renders demo correctly 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="text" placeholder="收货人姓名" value="" class="van-field__control">
<div class="van-field__body"><input type="text" placeholder="收货人姓名" value="" class="van-field__control">
<!---->
<!---->
<!---->
@ -26,8 +25,7 @@ exports[`renders demo correctly 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="tel" placeholder="收货人手机号" value="" class="van-field__control">
<div class="van-field__body"><input type="tel" placeholder="收货人手机号" value="" class="van-field__control">
<!---->
<!---->
<!---->
@ -42,8 +40,7 @@ exports[`renders demo correctly 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="text" readonly="readonly" placeholder="选择省 / 市 / 区" value="" class="van-field__control">
<div class="van-field__body"><input type="text" readonly="readonly" placeholder="选择省 / 市 / 区" value="" class="van-field__control">
<!---->
<!---->
<!---->
@ -62,8 +59,7 @@ exports[`renders demo correctly 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<textarea rows="1" maxlength="200" placeholder="街道门牌、楼层房间号等信息" class="van-field__control"></textarea>
<div class="van-field__body"><textarea rows="1" maxlength="200" placeholder="街道门牌、楼层房间号等信息" class="van-field__control"></textarea>
<!---->
<!---->
<!---->
@ -81,8 +77,7 @@ exports[`renders demo correctly 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="tel" maxlength="6" placeholder="邮政编码" value="" class="van-field__control">
<div class="van-field__body"><input type="tel" maxlength="6" placeholder="邮政编码" value="" class="van-field__control">
<!---->
<!---->
<!---->
@ -105,15 +100,12 @@ exports[`renders demo correctly 1`] = `
</div>
<!---->
</div>
<div class="van-address-edit__buttons">
<button class="van-button van-button--danger van-button--normal van-button--block"><span class="van-button__text">
<div class="van-address-edit__buttons"><button class="van-button van-button--danger van-button--normal van-button--block"><span class="van-button__text">
保存
</span></button>
<button class="van-button van-button--default van-button--normal van-button--block"><span class="van-button__text">
</span></button> <button class="van-button van-button--default van-button--normal van-button--block"><span class="van-button__text">
删除
</span></button>
</div>
<div name="popup-slide-bottom" class="van-popup van-popup--bottom" style="display:none;">
</span></button></div>
<div class="van-popup van-popup--bottom" style="display:none;">
<div class="van-picker van-area">
<div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">

View File

@ -8,8 +8,7 @@ exports[`create a AddressEdit 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="text" placeholder="收货人姓名" value="" class="van-field__control">
<div class="van-field__body"><input type="text" placeholder="收货人姓名" value="" class="van-field__control">
<!---->
<!---->
<!---->
@ -24,8 +23,7 @@ exports[`create a AddressEdit 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="tel" placeholder="收货人手机号" value="" class="van-field__control">
<div class="van-field__body"><input type="tel" placeholder="收货人手机号" value="" class="van-field__control">
<!---->
<!---->
<!---->
@ -40,8 +38,7 @@ exports[`create a AddressEdit 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="text" readonly="readonly" placeholder="选择省 / 市 / 区" value="" class="van-field__control">
<div class="van-field__body"><input type="text" readonly="readonly" placeholder="选择省 / 市 / 区" value="" class="van-field__control">
<!---->
<!---->
<!---->
@ -60,8 +57,7 @@ exports[`create a AddressEdit 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<textarea rows="1" maxlength="200" placeholder="街道门牌、楼层房间号等信息" class="van-field__control"></textarea>
<div class="van-field__body"><textarea rows="1" maxlength="200" placeholder="街道门牌、楼层房间号等信息" class="van-field__control"></textarea>
<!---->
<!---->
<!---->
@ -75,8 +71,7 @@ exports[`create a AddressEdit 1`] = `
</div>
<!---->
<!---->
<div class="van-address-edit__buttons">
<button class="van-button van-button--danger van-button--normal van-button--block"><span class="van-button__text">
<div class="van-address-edit__buttons"><button class="van-button van-button--danger van-button--normal van-button--block"><span class="van-button__text">
保存
</span></button>
<!---->
@ -120,8 +115,7 @@ exports[`create a AddressEdit with props 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="text" placeholder="收货人姓名" value="测试" class="van-field__control">
<div class="van-field__body"><input type="text" placeholder="收货人姓名" value="测试" class="van-field__control">
<!---->
<!---->
<!---->
@ -136,8 +130,7 @@ exports[`create a AddressEdit with props 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="tel" placeholder="收货人手机号" value="13000000000" class="van-field__control">
<div class="van-field__body"><input type="tel" placeholder="收货人手机号" value="13000000000" class="van-field__control">
<!---->
<!---->
<!---->
@ -152,8 +145,7 @@ exports[`create a AddressEdit with props 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="text" readonly="readonly" placeholder="选择省 / 市 / 区" value="北京市/朝阳区" class="van-field__control">
<div class="van-field__body"><input type="text" readonly="readonly" placeholder="选择省 / 市 / 区" value="北京市/朝阳区" class="van-field__control">
<!---->
<!---->
<!---->
@ -172,8 +164,7 @@ exports[`create a AddressEdit with props 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<textarea rows="1" maxlength="200" placeholder="街道门牌、楼层房间号等信息" class="van-field__control">详细地址</textarea>
<div class="van-field__body"><textarea rows="1" maxlength="200" placeholder="街道门牌、楼层房间号等信息" class="van-field__control">详细地址</textarea>
<!---->
<!---->
<!---->
@ -191,8 +182,7 @@ exports[`create a AddressEdit with props 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="tel" maxlength="6" placeholder="邮政编码" value="10000" class="van-field__control">
<div class="van-field__body"><input type="tel" maxlength="6" placeholder="邮政编码" value="10000" class="van-field__control">
<!---->
<!---->
<!---->
@ -215,8 +205,7 @@ exports[`create a AddressEdit with props 1`] = `
</div>
<!---->
</div>
<div class="van-address-edit__buttons">
<button class="van-button van-button--danger van-button--normal van-button--block"><span class="van-button__text">
<div class="van-address-edit__buttons"><button class="van-button van-button--danger van-button--normal van-button--block"><span class="van-button__text">
保存
</span></button>
<!---->

View File

@ -1,6 +1,6 @@
/* eslint-disable camelcase */
import { renderToString } from '@vue/server-test-utils';
import AddressEdit from '../';
import AddressEdit from '..';
import areaList from '../../area/demo/area.simple';
import { mount, later, transitionStub } from '../../../test/utils';
@ -132,11 +132,11 @@ test('on change detail', () => {
test('watch address info', () => {
const wrapper = mount(AddressEdit);
wrapper.setProps({ addressInfo: { name: '123' }});
wrapper.setProps({ addressInfo: { name: '123' } });
expect(wrapper.vm.data.name).toEqual('123');
});
test('set/get area code', async() => {
test('set/get area code', async () => {
const wrapper = mount(AddressEdit, {
propsData: { areaList }
});
@ -162,7 +162,7 @@ test('set/get area code', async() => {
expect(wrapper.vm.getArea()).toEqual([]);
});
test('watch area code', async() => {
test('watch area code', async () => {
const wrapper = mount(AddressEdit, {
propsData: {
areaList: {},
@ -179,7 +179,7 @@ test('watch area code', async() => {
expect(wrapper.vm.data.city).toEqual('北京市');
});
test('show search result', async() => {
test('show search result', async () => {
const wrapper = mount(AddressEdit, {
propsData: {
showSearchResult: true,
@ -208,7 +208,7 @@ test('show search result', async() => {
expect(wrapper.vm.detailFocused).toBeFalsy();
});
test('delete address', async() => {
test('delete address', async () => {
const wrapper = mount(AddressEdit, {
attachToDocument: true,
propsData: {

View File

@ -84,7 +84,7 @@ export default {
},
onEdit(item, index) {
this.$toast(this.$t('edit') + ':' + index);
this.$toast(`${this.$t('edit')}:${index}`);
}
}
};

View File

@ -11,22 +11,18 @@ exports[`renders demo correctly 1`] = `
<!---->
<div class="van-cell__value van-cell__value--alone">
<div class="van-radio"><span class="van-radio__input"><input type="radio" value="1" checked="checked" class="van-radio__control"> <i class="van-icon van-icon-checked" style="color:undefined;font-size:undefined;"> <!----> <!----></i></span> <span class="van-radio__label"><div class="van-address-item__name">张三13000000000</div> <div class="van-address-item__address">浙江省杭州市西湖区文三路 138 号东方通信大厦 7 楼 501 室</div></span></div>
</div>
<i class="van-icon van-icon-edit van-address-item__edit" style="color:undefined;font-size:undefined;">
</div> <i class="van-icon van-icon-edit van-address-item__edit" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
<div class="van-cell van-cell--clickable van-address-item">
<!---->
<!---->
<div class="van-cell__value van-cell__value--alone">
<div class="van-radio"><span class="van-radio__input"><input type="radio" value="2" class="van-radio__control"> <i class="van-icon van-icon-check" style="color:undefined;font-size:undefined;"> <!----> <!----></i></span> <span class="van-radio__label"><div class="van-address-item__name">李四1310000000</div> <div class="van-address-item__address">浙江省杭州市拱墅区莫干山路 50 号</div></span></div>
</div>
<i class="van-icon van-icon-edit van-address-item__edit" style="color:undefined;font-size:undefined;">
</div> <i class="van-icon van-icon-edit van-address-item__edit" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
</div>
</div>
@ -39,14 +35,11 @@ exports[`renders demo correctly 1`] = `
<!---->
<div class="van-cell__value van-cell__value--alone">
<div class="van-radio"><span class="van-radio__input"><input type="radio" value="3" class="van-radio__control"> <i class="van-icon van-icon-check" style="color:undefined;font-size:undefined;"> <!----> <!----></i></span> <span class="van-radio__label"><div class="van-address-item__name">王五1320000000</div> <div class="van-address-item__address">浙江省杭州市滨江区江南大道 15 号</div></span></div>
</div>
<i class="van-icon van-icon-edit van-address-item__edit" style="color:undefined;font-size:undefined;">
</div> <i class="van-icon van-icon-edit van-address-item__edit" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
</div>
<button class="van-button van-button--danger van-button--large van-button--square van-address-list__add"><span class="van-button__text">新增地址</span></button>
</div> <button class="van-button van-button--danger van-button--large van-button--square van-address-list__add"><span class="van-button__text">新增地址</span></button>
</div>
</div>
</div>

View File

@ -1,71 +1,71 @@
export default {
'province_list': {
'110000': 'Beijing',
'330000': 'Zhejiang',
'810000': 'Hong Kong'
province_list: {
110000: 'Beijing',
330000: 'Zhejiang',
810000: 'Hong Kong'
},
'city_list': {
'110100': 'Beijing City',
'330100': 'Hangzhou',
'330200': 'Ningbo',
'330300': 'Wenzhou',
'330400': 'Jiaxin',
'331100': 'Lishui',
'810100': 'Hong Kong Island',
'810200': 'Kowloon',
'810300': 'New Territories'
city_list: {
110100: 'Beijing City',
330100: 'Hangzhou',
330200: 'Ningbo',
330300: 'Wenzhou',
330400: 'Jiaxin',
331100: 'Lishui',
810100: 'Hong Kong Island',
810200: 'Kowloon',
810300: 'New Territories'
},
'county_list': {
'110101': 'Dongcheng',
'110102': 'Xicheng',
'110105': 'Chaoyang',
'110106': 'Fengtai',
'110108': 'Haidian',
'110111': 'Fangshan',
'110112': 'Tongzhou',
'110113': 'Shunyi',
'110114': 'Changping',
'110115': 'Daxing',
'330105': 'Gongshu',
'330106': 'Xihu',
'330108': 'Binjiang',
'330109': 'Xiaoshan',
'330110': 'Yuhang',
'330111': 'Fuyang',
'330127': 'Chunan',
'330182': 'Jiande',
'330185': 'Linan',
'330206': 'Beilun',
'330211': 'Zhenhai',
'330225': 'Xiangshan',
'330226': 'Ninghai',
'330281': 'Yuyao',
'330282': 'Cixi',
'330327': 'Cangnan',
'330328': 'Wencheng',
'330329': 'Shuntai',
'330381': 'Ruian',
'330382': 'Yueqing',
'330402': 'Nanhu',
'330421': 'Jiashan',
'330424': 'Haiyan',
'330481': 'Haining',
'330482': 'Pinghu',
'330483': 'Tongxiang',
'331102': 'Liandu District',
'331121': 'Qingtian County',
'331125': 'Yunhe County',
'331181': 'Longquan County',
'810101': 'Central',
'810102': 'Wan Chai',
'810202': 'Mong Kok',
'810203': 'Sham Shui Po',
'810204': 'Chuk Un',
'810205': 'Kwun Tong',
'810303': 'Sha Tin',
'810305': 'Yuen Long',
'810306': 'Tuen Mun',
'810307': 'Tsuen Wan',
'810309': 'Lantau Island'
county_list: {
110101: 'Dongcheng',
110102: 'Xicheng',
110105: 'Chaoyang',
110106: 'Fengtai',
110108: 'Haidian',
110111: 'Fangshan',
110112: 'Tongzhou',
110113: 'Shunyi',
110114: 'Changping',
110115: 'Daxing',
330105: 'Gongshu',
330106: 'Xihu',
330108: 'Binjiang',
330109: 'Xiaoshan',
330110: 'Yuhang',
330111: 'Fuyang',
330127: 'Chunan',
330182: 'Jiande',
330185: 'Linan',
330206: 'Beilun',
330211: 'Zhenhai',
330225: 'Xiangshan',
330226: 'Ninghai',
330281: 'Yuyao',
330282: 'Cixi',
330327: 'Cangnan',
330328: 'Wencheng',
330329: 'Shuntai',
330381: 'Ruian',
330382: 'Yueqing',
330402: 'Nanhu',
330421: 'Jiashan',
330424: 'Haiyan',
330481: 'Haining',
330482: 'Pinghu',
330483: 'Tongxiang',
331102: 'Liandu District',
331121: 'Qingtian County',
331125: 'Yunhe County',
331181: 'Longquan County',
810101: 'Central',
810102: 'Wan Chai',
810202: 'Mong Kok',
810203: 'Sham Shui Po',
810204: 'Chuk Un',
810205: 'Kwun Tong',
810303: 'Sha Tin',
810305: 'Yuen Long',
810306: 'Tuen Mun',
810307: 'Tsuen Wan',
810309: 'Lantau Island'
}
};

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +1,21 @@
export default {
'province_list': {
'110000': '北京市',
'120000': '天津市'
province_list: {
110000: '北京市',
120000: '天津市'
},
'city_list': {
'110100': '北京市',
'110200': '县',
'120100': '天津市',
'120200': '县'
city_list: {
110100: '北京市',
110200: '县',
120100: '天津市',
120200: '县'
},
'county_list': {
'110101': '东城区',
'110102': '西城区',
'110228': '密云县',
'110229': '延庆县',
'120101': '和平区',
'120102': '河东区',
'120225': '蓟县'
county_list: {
110101: '东城区',
110102: '西城区',
110228: '密云县',
110229: '延庆县',
120101: '和平区',
120102: '河东区',
120225: '蓟县'
}
};

View File

@ -93,9 +93,9 @@ export default create({
}
const list = this[type];
result = Object.keys(list).map(code => ({
code,
name: list[code]
result = Object.keys(list).map(listCode => ({
code: listCode,
name: list[listCode]
}));
if (code) {
@ -150,7 +150,7 @@ export default create({
picker.setColumnValues(1, city);
if (city.length && code.slice(2, 4) === '00') {
code = city[0].code;
[{ code }] = city;
}
picker.setColumnValues(2, this.getList('county', code.slice(0, 4)));

View File

@ -14,13 +14,13 @@ exports[`change option 1`] = `
<!---->
<div class="van-picker__columns" style="height: 220px;">
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;"></ul>
<ul style="transform: translate3d(0, 88px, 0); line-height: 44px;"></ul>
</div>
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;"></ul>
<ul style="transform: translate3d(0, 88px, 0); line-height: 44px;"></ul>
</div>
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;"></ul>
<ul style="transform: translate3d(0, 88px, 0); line-height: 44px;"></ul>
</div>
<div class="van-hairline--top-bottom van-picker__frame" style="height: 44px;"></div>
</div>
@ -41,19 +41,19 @@ exports[`change option 2`] = `
<!---->
<div class="van-picker__columns" style="height: 220px;">
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;">
<ul style="transform: translate3d(0, 44px, 0); line-height: 44px;">
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">北京市</li>
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 44px;">天津市</li>
</ul>
</div>
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;">
<ul style="transform: translate3d(0, 88px, 0); line-height: 44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 44px;">天津市</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">县</li>
</ul>
</div>
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;">
<ul style="transform: translate3d(0, 88px, 0); line-height: 44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 44px;">和平区</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">河东区</li>
</ul>
@ -77,19 +77,19 @@ exports[`change option 3`] = `
<!---->
<div class="van-picker__columns" style="height: 220px;">
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;">
<ul style="transform: translate3d(0, 44px, 0); line-height: 44px;">
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">北京市</li>
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 44px;">天津市</li>
</ul>
</div>
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;">
<ul style="transform: translate3d(0, 88px, 0); line-height: 44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 44px;">天津市</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">县</li>
</ul>
</div>
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;">
<ul style="transform: translate3d(0, 44px, 0); line-height: 44px;">
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">和平区</li>
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 44px;">河东区</li>
</ul>
@ -113,19 +113,19 @@ exports[`reset method 1`] = `
<!---->
<div class="van-picker__columns" style="height: 220px;">
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;">
<ul style="transform: translate3d(0, 44px, 0); line-height: 44px;">
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">北京市</li>
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 44px;">天津市</li>
</ul>
</div>
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;">
<ul style="transform: translate3d(0, 44px, 0); line-height: 44px;">
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">天津市</li>
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 44px;">县</li>
</ul>
</div>
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;">
<ul style="transform: translate3d(0, 88px, 0); line-height: 44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 44px;">蓟县</li>
</ul>
</div>
@ -148,19 +148,19 @@ exports[`reset method 2`] = `
<!---->
<div class="van-picker__columns" style="height: 220px;">
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;">
<ul style="transform: translate3d(0, 88px, 0); line-height: 44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 44px;">北京市</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">天津市</li>
</ul>
</div>
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;">
<ul style="transform: translate3d(0, 88px, 0); line-height: 44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 44px;">北京市</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">县</li>
</ul>
</div>
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;">
<ul style="transform: translate3d(0, 88px, 0); line-height: 44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 44px;">东城区</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">西城区</li>
</ul>
@ -184,13 +184,13 @@ exports[`watch areaList & code 1`] = `
<!---->
<div class="van-picker__columns" style="height: 220px;">
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;"></ul>
<ul style="transform: translate3d(0, 88px, 0); line-height: 44px;"></ul>
</div>
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;"></ul>
<ul style="transform: translate3d(0, 88px, 0); line-height: 44px;"></ul>
</div>
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;"></ul>
<ul style="transform: translate3d(0, 88px, 0); line-height: 44px;"></ul>
</div>
<div class="van-hairline--top-bottom van-picker__frame" style="height: 44px;"></div>
</div>
@ -211,19 +211,19 @@ exports[`watch areaList & code 2`] = `
<!---->
<div class="van-picker__columns" style="height: 220px;">
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;">
<ul style="transform: translate3d(0, 88px, 0); line-height: 44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 44px;">北京市</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">天津市</li>
</ul>
</div>
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;">
<ul style="transform: translate3d(0, 88px, 0); line-height: 44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 44px;">北京市</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">县</li>
</ul>
</div>
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;">
<ul style="transform: translate3d(0, 88px, 0); line-height: 44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 44px;">东城区</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">西城区</li>
</ul>
@ -247,19 +247,19 @@ exports[`watch areaList & code 3`] = `
<!---->
<div class="van-picker__columns" style="height: 220px;">
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;">
<ul style="transform: translate3d(0, 88px, 0); line-height: 44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 44px;">北京市</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">天津市</li>
</ul>
</div>
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;">
<ul style="transform: translate3d(0, 88px, 0); line-height: 44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 44px;">北京市</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">县</li>
</ul>
</div>
<div class="van-picker-column" style="height: 220px;">
<ul style="line-height: 44px;">
<ul style="transform: translate3d(0, 88px, 0); line-height: 44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 44px;">东城区</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">西城区</li>
</ul>

View File

@ -8,7 +8,7 @@ const firstOption = [
{ code: '110101', name: '东城区' }
];
test('confirm & cancel event', async() => {
test('confirm & cancel event', async () => {
const wrapper = mount(Area, {
propsData: {
areaList
@ -24,7 +24,7 @@ test('confirm & cancel event', async() => {
expect(wrapper.emitted('cancel')[0][0]).toEqual(firstOption);
});
test('watch areaList & code', async() => {
test('watch areaList & code', async () => {
const wrapper = mount(Area, {
propsData: {
areaList
@ -71,7 +71,7 @@ test('getValues method', () => {
expect(wrapper.vm.getValues()).toEqual(firstOption);
});
test('reset method', async() => {
test('reset method', async () => {
const wrapper = mount(Area, {
propsData: {
areaList,

View File

@ -3,38 +3,33 @@
exports[`renders demo correctly 1`] = `
<div>
<div>
<div class="van-hairline--top-bottom van-badge-group">
<a class="van-badge van-badge--select van-hairline">
<div class="van-hairline--top-bottom van-badge-group"><a class="van-badge van-badge--select van-hairline">
<div class="van-badge__text">
标签名称
<!---->
</div>
</a>
<a class="van-badge van-hairline">
</a> <a class="van-badge van-hairline">
<div class="van-badge__text">
标签名称
<div class="van-info van-badge__info">
8
</div>
</div>
</a>
<a class="van-badge van-hairline">
</a> <a class="van-badge van-hairline">
<div class="van-badge__text">
标签名称
<div class="van-info van-badge__info">
99
</div>
</div>
</a>
<a class="van-badge van-hairline">
</a> <a class="van-badge van-hairline">
<div class="van-badge__text">
标签名称
<div class="van-info van-badge__info">
99+
</div>
</div>
</a>
</div>
</a></div>
</div>
</div>
`;

View File

@ -1,5 +1,5 @@
import { mount } from '../../../test/utils';
import Badge from '../';
import Badge from '..';
import BadgeGroup from '../../badge-group';
test('event', () => {

View File

@ -3,50 +3,28 @@
exports[`renders demo correctly 1`] = `
<div>
<div>
<div class="demo-button-row">
<button class="van-button van-button--primary van-button--normal"><span class="van-button__text">主要按钮</span></button>
<button class="van-button van-button--danger van-button--normal"><span class="van-button__text">危险按钮</span></button>
</div>
<button class="van-button van-button--default van-button--normal"><span class="van-button__text">默认按钮</span></button>
<button class="van-button van-button--warning van-button--normal"><span class="van-button__text">警告按钮</span></button>
<div class="demo-button-row"><button class="van-button van-button--primary van-button--normal"><span class="van-button__text">主要按钮</span></button> <button class="van-button van-button--danger van-button--normal"><span class="van-button__text">危险按钮</span></button></div> <button class="van-button van-button--default van-button--normal"><span class="van-button__text">默认按钮</span></button> <button class="van-button van-button--warning van-button--normal"><span class="van-button__text">警告按钮</span></button>
</div>
<div>
<button class="van-button van-button--primary van-button--normal van-button--plain"><span class="van-button__text">
<div><button class="van-button van-button--primary van-button--normal van-button--plain"><span class="van-button__text">
朴素按钮
</span></button>
<button class="van-button van-button--danger van-button--normal van-button--plain"><span class="van-button__text">
</span></button> <button class="van-button van-button--danger van-button--normal van-button--plain"><span class="van-button__text">
朴素按钮
</span></button>
</div>
<div>
<button disabled="disabled" class="van-button van-button--primary van-button--normal van-button--disabled van-button--unclickable"><span class="van-button__text">
</span></button></div>
<div><button disabled="disabled" class="van-button van-button--primary van-button--normal van-button--disabled van-button--unclickable"><span class="van-button__text">
禁用状态
</span></button>
<button disabled="disabled" class="van-button van-button--danger van-button--normal van-button--disabled van-button--unclickable"><span class="van-button__text">
</span></button> <button disabled="disabled" class="van-button van-button--danger van-button--normal van-button--disabled van-button--unclickable"><span class="van-button__text">
禁用状态
</span></button>
</div>
<div>
<button class="van-button van-button--primary van-button--normal van-button--loading van-button--unclickable">
</span></button></div>
<div><button class="van-button van-button--primary van-button--normal van-button--loading van-button--unclickable">
<div class="van-loading van-loading--circular van-loading" style="color:;width:20px;height:20px;"><span class="van-loading__spinner van-loading__spinner--circular"> <svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div>
</button>
<button class="van-button van-button--danger van-button--normal van-button--loading van-button--unclickable">
</button> <button class="van-button van-button--danger van-button--normal van-button--loading van-button--unclickable">
<div class="van-loading van-loading--circular van-loading" style="color:;width:20px;height:20px;"><span class="van-loading__spinner van-loading__spinner--circular"> <svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div>
</button>
</div>
<div>
<button class="van-button van-button--primary van-button--normal van-button--square"><span class="van-button__text">
</button></div>
<div><button class="van-button van-button--primary van-button--normal van-button--square"><span class="van-button__text">
方形按钮
</span></button>
<button class="van-button van-button--danger van-button--normal van-button--round"><span class="van-button__text">
</span></button> <button class="van-button van-button--danger van-button--normal van-button--round"><span class="van-button__text">
圆形按钮
</span></button>
</div>
<div>
<button class="van-button van-button--default van-button--large"><span class="van-button__text">大号按钮</span></button>
<button class="van-button van-button--default van-button--normal"><span class="van-button__text">普通按钮</span></button>
<button class="van-button van-button--default van-button--small"><span class="van-button__text">小型按钮</span></button>
<button class="van-button van-button--default van-button--mini"><span class="van-button__text">迷你按钮</span></button>
</div>
</span></button></div>
<div><button class="van-button van-button--default van-button--large"><span class="van-button__text">大号按钮</span></button> <button class="van-button van-button--default van-button--normal"><span class="van-button__text">普通按钮</span></button> <button class="van-button van-button--default van-button--small"><span class="van-button__text">小型按钮</span></button> <button class="van-button van-button--default van-button--mini"><span class="van-button__text">迷你按钮</span></button></div>
</div>
`;

View File

@ -81,16 +81,13 @@ export default create({
thumb: String,
title: String,
centered: Boolean,
thumbLink: String,
num: [Number, String],
price: [Number, String],
originPrice: [Number, String],
currency: {
type: String,
default: '¥'
},
thumbLink: {
type: String,
default: 'javascript:;'
}
}
});

View File

@ -3,11 +3,8 @@
exports[`renders demo correctly 1`] = `
<div>
<div>
<div class="van-card">
<a href="javascript:;" class="van-card__thumb">
<img src="//img.yzcdn.cn/upload_files/2017/07/02/af5b9f44deaeb68000d7e4a711160c53.jpg" class="van-card__img">
<!---->
</a>
<div class="van-card"><a class="van-card__thumb"><img src="//img.yzcdn.cn/upload_files/2017/07/02/af5b9f44deaeb68000d7e4a711160c53.jpg" class="van-card__img">
<!----></a>
<div class="van-card__content">
<div class="van-card__left">
<div class="van-card__title">
@ -29,9 +26,7 @@ exports[`renders demo correctly 1`] = `
</div>
</div>
<div>
<div class="van-card">
<a href="javascript:;" class="van-card__thumb">
<img src="//img.yzcdn.cn/upload_files/2017/07/02/af5b9f44deaeb68000d7e4a711160c53.jpg" class="van-card__img"> <span class="van-tag van-tag--mark van-card__tag" style="background-color:#f44;">
<div class="van-card"><a class="van-card__thumb"><img src="//img.yzcdn.cn/upload_files/2017/07/02/af5b9f44deaeb68000d7e4a711160c53.jpg" class="van-card__img"> <span class="van-tag van-tag--mark van-card__tag" style="background-color:#f44;">
标签
</span></a>
<div class="van-card__content">
@ -54,10 +49,7 @@ exports[`renders demo correctly 1`] = `
</div>
</div>
<div class="van-card__footer">
<div>
<button class="van-button van-button--default van-button--mini"><span class="van-button__text">按钮</span></button>
<button class="van-button van-button--default van-button--mini"><span class="van-button__text">按钮</span></button>
</div>
<div><button class="van-button van-button--default van-button--mini"><span class="van-button__text">按钮</span></button> <button class="van-button van-button--default van-button--mini"><span class="van-button__text">按钮</span></button></div>
</div>
</div>
</div>

View File

@ -41,11 +41,9 @@ exports[`renders demo correctly 1`] = `
</div>
</div>
<div>
<div class="van-cell">
<i class="van-icon van-icon-location van-cell__left-icon" style="color:undefined;font-size:undefined;">
<div class="van-cell"><i class="van-icon van-icon-location van-cell__left-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
<div class="van-cell__title"><span>单元格</span>
<!---->
</div>
@ -67,33 +65,27 @@ exports[`renders demo correctly 1`] = `
<div class="van-cell__title"><span>单元格</span>
<!---->
</div>
<!---->
<i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!----> <i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
<div class="van-cell van-cell--clickable">
<!---->
<div class="van-cell__title"><span>单元格</span>
<!---->
</div>
<div class="van-cell__value"><span>内容</span></div>
<i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<div class="van-cell__value"><span>内容</span></div> <i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
<div class="van-cell van-cell--clickable">
<!---->
<div class="van-cell__title"><span>单元格</span>
<!---->
</div>
<div class="van-cell__value"><span>内容</span></div>
<i class="van-icon van-icon-arrow-down van-cell__right-icon" style="color:undefined;font-size:undefined;">
<div class="van-cell__value"><span>内容</span></div> <i class="van-icon van-icon-arrow-down van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
</div>
<div>
@ -102,61 +94,47 @@ exports[`renders demo correctly 1`] = `
<div class="van-cell__title"><span>单元格</span>
<!---->
</div>
<!---->
<i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!----> <i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
<div class="van-cell van-cell--clickable">
<!---->
<div class="van-cell__title"><span>单元格</span>
<!---->
</div>
<!---->
<i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!----> <i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
</div>
<div>
<div class="van-cell van-cell--clickable">
<i class="van-icon van-icon-shop van-cell__left-icon" style="color:undefined;font-size:undefined;">
<div class="van-cell van-cell--clickable"><i class="van-icon van-icon-shop van-cell__left-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
<div class="van-cell__title"><span class="custom-text">单元格</span> <span class="van-tag" style="background-color:#f44;">标签</span></div>
<div class="van-cell__value"><span>内容</span></div>
<i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<div class="van-cell__value"><span>内容</span></div> <i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
<div class="van-cell van-cell--clickable">
<i class="van-icon van-icon-location van-cell__left-icon" style="color:undefined;font-size:undefined;">
<div class="van-cell van-cell--clickable"><i class="van-icon van-icon-location van-cell__left-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
<div class="van-cell__title"><span>单元格</span>
<!---->
</div>
<!---->
<i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!----> <i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
<div class="van-cell">
<!---->
<div class="van-cell__title"><span>单元格</span>
<!---->
</div>
<!---->
<i class="custom-icon van-icon van-icon-search" style="color:undefined;font-size:undefined;">
<!----> <i class="custom-icon van-icon van-icon-search" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
</div>
</div>

View File

@ -68,7 +68,7 @@
<demo-block :title="$t('title5')">
<van-checkbox-group v-model="result3">
<van-cell-group >
<van-cell-group>
<van-cell
v-for="(item, index) in list"
clickable

View File

@ -4,112 +4,91 @@ exports[`renders demo correctly 1`] = `
<div>
<div>
<div class="van-checkbox">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--checked">
<i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--checked"><i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
</div> <span class="van-checkbox__label">复选框</span></div>
<!----></i></div> <span class="van-checkbox__label">复选框</span>
</div>
</div>
<div>
<div class="van-checkbox">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--disabled">
<i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--disabled"><i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
</div> <span class="van-checkbox__label van-checkbox__label--disabled">
<!----></i></div> <span class="van-checkbox__label van-checkbox__label--disabled">
复选框
</span></div>
</span>
</div>
<div class="van-checkbox">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--disabled van-checkbox__icon--checked">
<i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--disabled van-checkbox__icon--checked"><i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
</div> <span class="van-checkbox__label van-checkbox__label--disabled">
<!----></i></div> <span class="van-checkbox__label van-checkbox__label--disabled">
复选框
</span></div>
</span>
</div>
</div>
<div>
<div class="van-checkbox">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--checked">
<i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;border-color:#4b0;background-color:#4b0;">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--checked"><i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;border-color:#4b0;background-color:#4b0;">
<!---->
<!---->
</i>
</div> <span class="van-checkbox__label">
<!----></i></div> <span class="van-checkbox__label">
自定义颜色
</span></div>
</span>
</div>
</div>
<div>
<div class="van-checkbox">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--checked">
<img src="https://img.yzcdn.cn/public_files/2017/10/13/793c77793db8641c4c325b7f25bf130d.png">
</div> <span class="van-checkbox__label">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--checked"><img src="https://img.yzcdn.cn/public_files/2017/10/13/793c77793db8641c4c325b7f25bf130d.png"></div> <span class="van-checkbox__label">
自定义图标
</span></div>
</div>
<div>
<div class="van-checkbox-group">
<div class="van-checkbox">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--checked">
<i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
</div> <span class="van-checkbox__label">
复选框 a
</span></div>
<div class="van-checkbox">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--checked">
<i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
</div> <span class="van-checkbox__label">
复选框 b
</span></div>
<div class="van-checkbox">
<div class="van-checkbox__icon van-checkbox__icon--round">
<i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
</div> <span class="van-checkbox__label">
复选框 c
</span></div>
</span>
</div>
</div>
<div>
<div class="van-checkbox-group">
<div class="van-checkbox">
<div class="van-checkbox__icon van-checkbox__icon--round">
<i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--checked"><i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
</div> <span class="van-checkbox__label">
<!----></i></div> <span class="van-checkbox__label">
复选框 a
</span></div>
</span>
</div>
<div class="van-checkbox">
<div class="van-checkbox__icon van-checkbox__icon--round">
<i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--checked"><i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
</div> <span class="van-checkbox__label">
<!----></i></div> <span class="van-checkbox__label">
复选框 b
</span></div>
</span>
</div>
<div class="van-checkbox">
<div class="van-checkbox__icon van-checkbox__icon--round">
<i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<div class="van-checkbox__icon van-checkbox__icon--round"><i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
</div> <span class="van-checkbox__label">
<!----></i></div> <span class="van-checkbox__label">
复选框 c
</span></div>
</span>
</div>
</div>
</div>
<div>
<div class="van-checkbox-group">
<div class="van-checkbox">
<div class="van-checkbox__icon van-checkbox__icon--round"><i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<!---->
<!----></i></div> <span class="van-checkbox__label">
复选框 a
</span>
</div>
<div class="van-checkbox">
<div class="van-checkbox__icon van-checkbox__icon--round"><i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<!---->
<!----></i></div> <span class="van-checkbox__label">
复选框 b
</span>
</div>
<div class="van-checkbox">
<div class="van-checkbox__icon van-checkbox__icon--round"><i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<!---->
<!----></i></div> <span class="van-checkbox__label">
复选框 c
</span>
</div>
</div>
</div>
<div>
@ -122,12 +101,9 @@ exports[`renders demo correctly 1`] = `
</div>
<div class="van-cell__value">
<div class="van-checkbox">
<div class="van-checkbox__icon van-checkbox__icon--round">
<i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<div class="van-checkbox__icon van-checkbox__icon--round"><i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
</div>
<!----></i></div>
<!---->
</div>
</div>
@ -140,12 +116,9 @@ exports[`renders demo correctly 1`] = `
</div>
<div class="van-cell__value">
<div class="van-checkbox">
<div class="van-checkbox__icon van-checkbox__icon--round">
<i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<div class="van-checkbox__icon van-checkbox__icon--round"><i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
</div>
<!----></i></div>
<!---->
</div>
</div>
@ -158,12 +131,9 @@ exports[`renders demo correctly 1`] = `
</div>
<div class="van-cell__value">
<div class="van-checkbox">
<div class="van-checkbox__icon van-checkbox__icon--round">
<i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<div class="van-checkbox__icon van-checkbox__icon--round"><i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
</div>
<!----></i></div>
<!---->
</div>
</div>

View File

@ -3,24 +3,19 @@
exports[`renders demo correctly 1`] = `
<div>
<div>
<div class="van-circle" style="width:120px;height:120px;">
<svg viewBox="0 0 1060 1060">
<div class="van-circle" style="width:120px;height:120px;"><svg viewBox="0 0 1060 1060">
<path d="M 530 530 m -500, 0 a 500, 500 0 1, 1 1000, 0 a 500, 500 0 1, 1 -1000, 0" class="van-circle__hover" style="fill:none;stroke:#fff;stroke-width:40px;"></path>
<path d="M 530 530 m -500, 0 a 500, 500 0 1, 1 1000, 0 a 500, 500 0 1, 1 -1000, 0" class="van-circle__layer" style="stroke:#1989fa;stroke-dashoffset:3140px;stroke-width:41px;"></path>
</svg>
<div class="van-circle__text">0%</div>
</div>
<div class="van-circle" style="width:120px;height:120px;">
<svg viewBox="0 0 1060 1060">
<div class="van-circle" style="width:120px;height:120px;"><svg viewBox="0 0 1060 1060">
<path d="M 530 530 m -500, 0 a 500, 500 0 1, 1 1000, 0 a 500, 500 0 1, 1 -1000, 0" class="van-circle__hover" style="fill:#fff;stroke:#ebedf0;stroke-width:60px;"></path>
<path d="M 530 530 m -500, 0 a 500, 500 0 1, 1 1000, 0 a 500, 500 0 1, 1 -1000, 0" class="van-circle__layer" style="stroke:#13ce66;stroke-dashoffset:3140px;stroke-width:61px;"></path>
</svg>
<div class="van-circle__text">0%</div>
</div>
<div>
<button class="van-button van-button--primary van-button--small"><span class="van-button__text">增加</span></button>
<button class="van-button van-button--danger van-button--small"><span class="van-button__text">减少</span></button>
</div>
<div><button class="van-button van-button--primary van-button--small"><span class="van-button__text">增加</span></button> <button class="van-button van-button--danger van-button--small"><span class="van-button__text">减少</span></button></div>
</div>
</div>
`;

View File

@ -116,7 +116,7 @@ export default create({
return;
}
const contentHeight = content.clientHeight + 'px';
const contentHeight = `${content.clientHeight}px`;
wrapper.style.height = expanded ? 0 : contentHeight;
raf(() => {
wrapper.style.height = expanded ? contentHeight : 0;

View File

@ -10,11 +10,9 @@ exports[`renders demo correctly 1`] = `
<div class="van-cell__title"><span>有赞微商城</span>
<!---->
</div>
<div class="van-cell__value"> </div>
<i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<div class="van-cell__value"> </div> <i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
<div class="van-collapse-item__wrapper">
<div class="van-collapse-item__content">提供多样店铺模板,快速搭建网上商城</div>
@ -26,11 +24,9 @@ exports[`renders demo correctly 1`] = `
<div class="van-cell__title"><span>有赞零售</span>
<!---->
</div>
<div class="van-cell__value"> </div>
<i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<div class="van-cell__value"> </div> <i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
<!---->
</div>
@ -40,11 +36,9 @@ exports[`renders demo correctly 1`] = `
<div class="van-cell__title"><span>有赞美业</span>
<!---->
</div>
<div class="van-cell__value"> </div>
<i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<div class="van-cell__value"> </div> <i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
<!---->
</div>
@ -58,11 +52,9 @@ exports[`renders demo correctly 1`] = `
<div class="van-cell__title"><span>有赞微商城</span>
<!---->
</div>
<div class="van-cell__value"> </div>
<i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<div class="van-cell__value"> </div> <i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
<div class="van-collapse-item__wrapper">
<div class="van-collapse-item__content">提供多样店铺模板,快速搭建网上商城</div>
@ -74,11 +66,9 @@ exports[`renders demo correctly 1`] = `
<div class="van-cell__title"><span>有赞零售</span>
<!---->
</div>
<div class="van-cell__value"> </div>
<i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<div class="van-cell__value"> </div> <i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
<!---->
</div>
@ -88,11 +78,9 @@ exports[`renders demo correctly 1`] = `
<div class="van-cell__title"><span>有赞美业</span>
<!---->
</div>
<div class="van-cell__value"> </div>
<i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<div class="van-cell__value"> </div> <i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
<!---->
</div>
@ -104,35 +92,26 @@ exports[`renders demo correctly 1`] = `
<div class="van-cell van-cell--clickable van-collapse-item__title">
<!---->
<div class="van-cell__title">
<div>有赞微商城
<i class="van-icon van-icon-question" style="color:undefined;font-size:undefined;">
<div>有赞微商城<i class="van-icon van-icon-question" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
</div>
<!----></i></div>
</div>
<div class="van-cell__value"> </div>
<i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<div class="van-cell__value"> </div> <i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
<!---->
</div>
<div class="van-collapse-item van-hairline--top">
<div class="van-cell van-cell--clickable van-collapse-item__title">
<i class="van-icon van-icon-shop van-cell__left-icon" style="color:undefined;font-size:undefined;">
<div class="van-cell van-cell--clickable van-collapse-item__title"><i class="van-icon van-icon-shop van-cell__left-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
<div class="van-cell__title"><span>有赞零售</span>
<!---->
</div>
<div class="van-cell__value"> </div>
<i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<div class="van-cell__value"> </div> <i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
<!---->
</div>

View File

@ -24,7 +24,7 @@ const component = {
}
};
test('basic mode', async() => {
test('basic mode', async () => {
const wrapper = mount(component);
const titles = wrapper.findAll('.van-collapse-item__title');
@ -41,7 +41,7 @@ test('basic mode', async() => {
wrapper.destroy();
});
it('accordion', async() => {
it('accordion', async () => {
const wrapper = mount(component, {
propsData: {
accordion: true

View File

@ -3,17 +3,13 @@
exports[`renders demo correctly 1`] = `
<div>
<div>
<div class="van-cell van-cell--center van-cell--borderless van-cell--clickable van-contact-card van-contact-card--add">
<i class="van-icon van-icon-add2 van-cell__left-icon" style="color:undefined;font-size:undefined;">
<div class="van-cell van-cell--center van-cell--borderless van-cell--clickable van-contact-card van-contact-card--add"><i class="van-icon van-icon-add2 van-cell__left-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
<!---->
<div class="van-cell__value van-cell__value--alone">添加联系人</div>
<i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<div class="van-cell__value van-cell__value--alone">添加联系人</div> <i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
<div name="popup-slide-bottom" class="van-popup van-popup--bottom" style="display:none;">
<div class="van-contact-list">
@ -24,15 +20,12 @@ exports[`renders demo correctly 1`] = `
<!---->
<div class="van-cell__value van-cell__value--alone">
<div class="van-radio"><span class="van-radio__input"><input type="radio" value="0" class="van-radio__control"> <i class="van-icon van-icon-check" style="color:undefined;font-size:undefined;"> <!----> <!----></i></span> <span class="van-radio__label"><div class="van-contact-list__name">张三13000000000</div></span></div>
</div>
<i class="van-icon van-icon-edit van-contact-list__edit" style="color:undefined;font-size:undefined;">
</div> <i class="van-icon van-icon-edit van-contact-list__edit" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
</div>
</div>
<button class="van-button van-button--danger van-button--large van-button--square van-contact-list__add"><span class="van-button__text">新建联系人</span></button>
</div> <button class="van-button van-button--danger van-button--large van-button--square van-contact-list__add"><span class="van-button__text">新建联系人</span></button>
</div>
</div>
<div name="popup-slide-bottom" class="van-popup van-popup--bottom" style="display:none;">
@ -44,8 +37,7 @@ exports[`renders demo correctly 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="text" maxlength="30" placeholder="请填写姓名" class="van-field__control">
<div class="van-field__body"><input type="text" maxlength="30" placeholder="请填写姓名" class="van-field__control">
<!---->
<!---->
<!---->
@ -60,8 +52,7 @@ exports[`renders demo correctly 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="tel" placeholder="请填写电话" class="van-field__control">
<div class="van-field__body"><input type="tel" placeholder="请填写电话" class="van-field__control">
<!---->
<!---->
<!---->
@ -71,8 +62,7 @@ exports[`renders demo correctly 1`] = `
<!---->
</div>
</div>
<div class="van-contact-edit__buttons">
<button class="van-button van-button--danger van-button--normal van-button--block"><span class="van-button__text">
<div class="van-contact-edit__buttons"><button class="van-button van-button--danger van-button--normal van-button--block"><span class="van-button__text">
保存
</span></button>
<!---->
@ -81,11 +71,9 @@ exports[`renders demo correctly 1`] = `
</div>
</div>
<div>
<div class="van-cell van-cell--center van-cell--borderless van-contact-card van-contact-card--edit">
<i class="van-icon van-icon-contact van-cell__left-icon" style="color:undefined;font-size:undefined;">
<div class="van-cell van-cell--center van-cell--borderless van-contact-card van-contact-card--edit"><i class="van-icon van-icon-contact van-cell__left-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
<!---->
<div class="van-cell__value van-cell__value--alone">
<div>张三:张三</div>

View File

@ -82,11 +82,11 @@ describe('ContactEdit', () => {
test('watch contact info', () => {
const wrapper = mount(ContactEdit);
wrapper.setProps({ contactInfo: { name: '123' }});
wrapper.setProps({ contactInfo: { name: '123' } });
expect(wrapper.vm.data.name).toEqual('123');
});
test('delete contact', async() => {
test('delete contact', async () => {
const wrapper = mount(ContactEdit, {
propsData: {
isEdit: true

View File

@ -111,7 +111,7 @@ export default {
this.showList = false;
this.chosenCoupon = index;
},
onExchange(code) {
onExchange() {
this.$toast(this.$t('exchange'));
this.exchangedCoupons.push({
...this.coupon,

View File

@ -43,7 +43,7 @@
v-if="!coupons.length"
:class="b('empty')"
>
<img src="https://img.yzcdn.cn/v2/image/wap/trade/new_order/empty@2x.png" >
<img src="https://img.yzcdn.cn/v2/image/wap/trade/new_order/empty@2x.png">
<p>{{ $t('empty') }}</p>
</div>
</div>
@ -64,7 +64,7 @@
v-if="!disabledCoupons.length"
:class="b('empty')"
>
<img src="https://img.yzcdn.cn/v2/image/wap/trade/new_order/empty@2x.png" >
<img src="https://img.yzcdn.cn/v2/image/wap/trade/new_order/empty@2x.png">
<p>{{ $t('empty') }}</p>
</div>
</div>

View File

@ -8,11 +8,9 @@ exports[`renders demo correctly 1`] = `
<div class="van-cell__title"><span>优惠券</span>
<!---->
</div>
<div class="van-cell__value"><span>2张可用</span></div>
<i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<div class="van-cell__value"><span>2张可用</span></div> <i class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
<!---->
</div>

View File

@ -6,11 +6,9 @@ exports[`coupon cell 1`] = `
<div class="van-cell__title"><span>优惠券</span>
<!---->
</div>
<div class="van-cell__value"><span>使用优惠</span></div>
<i class="van-icon van-icon-arrow van-cell__right-icon">
<div class="van-cell__value"><span>使用优惠</span></div> <i class="van-icon van-icon-arrow van-cell__right-icon">
<!---->
<!---->
</i>
<!----></i>
</div>
`;
@ -20,10 +18,8 @@ exports[`coupon cell 2`] = `
<div class="van-cell__title"><span>优惠券</span>
<!---->
</div>
<div class="van-cell__value"><span>-¥1.00</span></div>
<i class="van-icon van-icon-arrow van-cell__right-icon">
<div class="van-cell__value"><span>-¥1.00</span></div> <i class="van-icon van-icon-arrow van-cell__right-icon">
<!---->
<!---->
</i>
<!----></i>
</div>
`;

View File

@ -75,7 +75,8 @@ export default {
formatter(type, value) {
if (type === 'year') {
return value + this.$t('year');
} else if (type === 'month') {
}
if (type === 'month') {
return value + this.$t('month');
}
return value;

View File

@ -141,9 +141,9 @@ export default create({
},
columns() {
const results = this.ranges.map(({ type, range }) => {
const values = this.times(range[1] - range[0] + 1, index => {
let value = range[0] + index;
const results = this.ranges.map(({ type, range: rangeArr }) => {
const values = this.times(rangeArr[1] - rangeArr[0] + 1, index => {
let value = rangeArr[0] + index;
value = value < 10 ? `0${value}` : `${value}`;
return this.formatter(type, value);
});

View File

@ -1,399 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders demo correctly 1`] = `
<div>
<div>
<div class="van-picker">
<div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">
取消
</div>
<!---->
<div class="van-picker__confirm">
确认
</div>
</div>
<!---->
<div class="van-picker__columns" style="height:220px;">
<div class="van-picker-column" style="height:220px;">
<ul style="transition:0ms;transform:translate3d(0, 88px, 0);line-height:44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height:44px;">2018</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2019</li>
</ul>
</div>
<div class="van-picker-column" style="height:220px;">
<ul style="transition:0ms;transform:translate3d(0, 88px, 0);line-height:44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height:44px;">01</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">02</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">03</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">04</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">05</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">06</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">07</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">08</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">09</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">10</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">11</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">12</li>
</ul>
</div>
<div class="van-picker-column" style="height:220px;">
<ul style="transition:0ms;transform:translate3d(0, 88px, 0);line-height:44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height:44px;">01</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">02</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">03</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">04</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">05</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">06</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">07</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">08</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">09</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">10</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">11</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">12</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">13</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">14</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">15</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">16</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">17</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">18</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">19</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">20</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">21</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">22</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">23</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">24</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">25</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">26</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">27</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">28</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">29</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">30</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">31</li>
</ul>
</div>
<div class="van-picker-column" style="height:220px;">
<ul style="transition:0ms;transform:translate3d(0, 88px, 0);line-height:44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height:44px;">00</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">01</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">02</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">03</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">04</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">05</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">06</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">07</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">08</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">09</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">10</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">11</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">12</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">13</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">14</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">15</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">16</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">17</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">18</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">19</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">20</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">21</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">22</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">23</li>
</ul>
</div>
<div class="van-picker-column" style="height:220px;">
<ul style="transition:0ms;transform:translate3d(0, 88px, 0);line-height:44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height:44px;">00</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">01</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">02</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">03</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">04</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">05</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">06</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">07</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">08</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">09</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">10</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">11</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">12</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">13</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">14</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">15</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">16</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">17</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">18</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">19</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">20</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">21</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">22</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">23</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">24</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">25</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">26</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">27</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">28</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">29</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">30</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">31</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">32</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">33</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">34</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">35</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">36</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">37</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">38</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">39</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">40</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">41</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">42</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">43</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">44</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">45</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">46</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">47</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">48</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">49</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">50</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">51</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">52</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">53</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">54</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">55</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">56</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">57</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">58</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">59</li>
</ul>
</div>
<div class="van-hairline--top-bottom van-picker__frame" style="height:44px;"></div>
</div>
</div>
</div>
<div>
<div class="van-picker">
<div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">
取消
</div>
<!---->
<div class="van-picker__confirm">
确认
</div>
</div>
<!---->
<div class="van-picker__columns" style="height:220px;">
<div class="van-picker-column" style="height:220px;">
<ul style="transition:0ms;transform:translate3d(0, 88px, 0);line-height:44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height:44px;">2018</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2019</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2020</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2021</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2022</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2023</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2024</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2025</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2026</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2027</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2028</li>
</ul>
</div>
<div class="van-picker-column" style="height:220px;">
<ul style="transition:0ms;transform:translate3d(0, 88px, 0);line-height:44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height:44px;">01</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">02</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">03</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">04</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">05</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">06</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">07</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">08</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">09</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">10</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">11</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">12</li>
</ul>
</div>
<div class="van-picker-column" style="height:220px;">
<ul style="transition:0ms;transform:translate3d(0, 88px, 0);line-height:44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height:44px;">01</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">02</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">03</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">04</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">05</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">06</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">07</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">08</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">09</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">10</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">11</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">12</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">13</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">14</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">15</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">16</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">17</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">18</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">19</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">20</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">21</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">22</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">23</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">24</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">25</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">26</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">27</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">28</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">29</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">30</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">31</li>
</ul>
</div>
<div class="van-hairline--top-bottom van-picker__frame" style="height:44px;"></div>
</div>
</div>
</div>
<div>
<div class="van-picker">
<div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">
取消
</div>
<!---->
<div class="van-picker__confirm">
确认
</div>
</div>
<!---->
<div class="van-picker__columns" style="height:220px;">
<div class="van-picker-column" style="height:220px;">
<ul style="transition:0ms;transform:translate3d(0, 88px, 0);line-height:44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height:44px;">2018年</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2019年</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2020年</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2021年</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2022年</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2023年</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2024年</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2025年</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2026年</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2027年</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">2028年</li>
</ul>
</div>
<div class="van-picker-column" style="height:220px;">
<ul style="transition:0ms;transform:translate3d(0, 88px, 0);line-height:44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height:44px;">01月</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">02月</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">03月</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">04月</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">05月</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">06月</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">07月</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">08月</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">09月</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">10月</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">11月</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">12月</li>
</ul>
</div>
<div class="van-hairline--top-bottom van-picker__frame" style="height:44px;"></div>
</div>
</div>
</div>
<div>
<div class="van-picker">
<div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">
取消
</div>
<!---->
<div class="van-picker__confirm">
确认
</div>
</div>
<!---->
<div class="van-picker__columns" style="height:220px;">
<div class="van-picker-column" style="height:220px;">
<ul style="transition:0ms;transform:translate3d(0, 88px, 0);line-height:44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height:44px;">10</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">11</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">12</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">13</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">14</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">15</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">16</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">17</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">18</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">19</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">20</li>
</ul>
</div>
<div class="van-picker-column" style="height:220px;">
<ul style="transition:0ms;transform:translate3d(0, 88px, 0);line-height:44px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height:44px;">00</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">01</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">02</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">03</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">04</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">05</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">06</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">07</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">08</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">09</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">10</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">11</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">12</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">13</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">14</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">15</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">16</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">17</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">18</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">19</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">20</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">21</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">22</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">23</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">24</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">25</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">26</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">27</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">28</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">29</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">30</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">31</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">32</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">33</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">34</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">35</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">36</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">37</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">38</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">39</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">40</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">41</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">42</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">43</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">44</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">45</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">46</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">47</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">48</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">49</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">50</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">51</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">52</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">53</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">54</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">55</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">56</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">57</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">58</li>
<li class="van-ellipsis van-picker-column__item" style="height:44px;">59</li>
</ul>
</div>
<div class="van-hairline--top-bottom van-picker__frame" style="height:44px;"></div>
</div>
</div>
</div>
</div>
`;
exports[`renders demo correctly 1`] = `""`;

View File

@ -55,11 +55,10 @@ Dialog.defaultOptions = {
Dialog.alert = Dialog;
Dialog.confirm = options =>
Dialog({
showCancelButton: true,
...options
});
Dialog.confirm = options => Dialog({
showCancelButton: true,
...options
});
Dialog.close = () => {
if (instance) {

View File

@ -2,21 +2,15 @@
exports[`renders demo correctly 1`] = `
<div>
<div>
<button class="van-button van-button--primary van-button--normal van-button--plain"><span class="van-button__text">
<div><button class="van-button van-button--primary van-button--normal van-button--plain"><span class="van-button__text">
消息提示
</span></button>
<button class="van-button van-button--primary van-button--normal van-button--plain"><span class="van-button__text">
</span></button> <button class="van-button van-button--primary van-button--normal van-button--plain"><span class="van-button__text">
无标题提示
</span></button>
</div>
<div>
<button class="van-button van-button--primary van-button--normal van-button--plain"><span class="van-button__text">
</span></button></div>
<div><button class="van-button van-button--primary van-button--normal van-button--plain"><span class="van-button__text">
消息确认
</span></button>
</div>
<div>
<button class="van-button van-button--danger van-button--normal van-button--plain"><span class="van-button__text">
</span></button></div>
<div><button class="van-button van-button--danger van-button--normal van-button--plain"><span class="van-button__text">
高级用法
</span></button>
<div name="van-dialog-bounce" class="van-dialog" style="display:none;">
@ -28,8 +22,7 @@ exports[`renders demo correctly 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="text" placeholder="请输入用户名" value="" class="van-field__control">
<div class="van-field__body"><input type="text" placeholder="请输入用户名" value="" class="van-field__control">
<!---->
<!---->
<!---->
@ -44,8 +37,7 @@ exports[`renders demo correctly 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="password" placeholder="请输入密码" value="" class="van-field__control">
<div class="van-field__body"><input type="password" placeholder="请输入密码" value="" class="van-field__control">
<!---->
<!---->
<!---->
@ -55,14 +47,11 @@ exports[`renders demo correctly 1`] = `
<!---->
</div>
</div>
<div class="van-hairline--top van-dialog__footer van-dialog__footer--buttons">
<button class="van-button van-button--default van-button--large van-dialog__cancel"><span class="van-button__text">
<div class="van-hairline--top van-dialog__footer van-dialog__footer--buttons"><button class="van-button van-button--default van-button--large van-dialog__cancel"><span class="van-button__text">
取消
</span></button>
<button class="van-button van-button--default van-button--large van-dialog__confirm van-hairline--left"><span class="van-button__text">
</span></button> <button class="van-button van-button--default van-button--large van-dialog__confirm van-hairline--left"><span class="van-button__text">
消息确认
</span></button>
</div>
</span></button></div>
</div>
</div>
</div>

View File

@ -5,7 +5,7 @@ import { mount, later, transitionStub } from '../../../test/utils';
transitionStub();
test('Dialog function call', async() => {
test('Dialog function call', async () => {
Dialog.close();
Dialog.alert('1');

View File

@ -8,8 +8,7 @@ exports[`renders demo correctly 1`] = `
<!---->
<!---->
<div class="van-cell__value van-cell__value--alone">
<div class="van-field__body">
<input type="text" placeholder="请输入用户名" value="" class="van-field__control">
<div class="van-field__body"><input type="text" placeholder="请输入用户名" value="" class="van-field__control">
<!---->
<!---->
<!---->
@ -28,15 +27,11 @@ exports[`renders demo correctly 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="text" placeholder="请输入用户名" value="" class="van-field__control">
<div class="van-field__body"><input type="text" placeholder="请输入用户名" value="" class="van-field__control">
<!---->
<div class="van-field__icon">
<i class="van-icon van-icon-question" style="color:undefined;font-size:undefined;">
<div class="van-field__icon"><i class="van-icon van-icon-question" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
</div>
<!----></i></div>
<!---->
</div>
<!---->
@ -49,8 +44,7 @@ exports[`renders demo correctly 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="password" placeholder="请输入密码" value="" class="van-field__control">
<div class="van-field__body"><input type="password" placeholder="请输入密码" value="" class="van-field__control">
<!---->
<!---->
<!---->
@ -63,17 +57,14 @@ exports[`renders demo correctly 1`] = `
</div>
<div>
<div class="van-cell-group van-hairline--top-bottom">
<div disabled="disabled" class="van-cell van-field">
<i class="van-icon van-icon-contact van-cell__left-icon" style="color:undefined;font-size:undefined;">
<div disabled="disabled" class="van-cell van-field"><i class="van-icon van-icon-contact van-cell__left-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
<div class="van-cell__title"><span>用户名</span>
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="text" disabled="disabled" value="输入框已禁用" class="van-field__control">
<div class="van-field__body"><input type="text" disabled="disabled" value="输入框已禁用" class="van-field__control">
<!---->
<!---->
<!---->
@ -92,8 +83,7 @@ exports[`renders demo correctly 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="text" placeholder="请输入用户名" value="" class="van-field__control">
<div class="van-field__body"><input type="text" placeholder="请输入用户名" value="" class="van-field__control">
<!---->
<!---->
<!---->
@ -108,8 +98,7 @@ exports[`renders demo correctly 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="text" placeholder="请输入手机号" value="1365577" class="van-field__control">
<div class="van-field__body"><input type="text" placeholder="请输入手机号" value="1365577" class="van-field__control">
<!---->
<!---->
<!---->
@ -128,8 +117,7 @@ exports[`renders demo correctly 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<textarea placeholder="请输入留言" rows="1" class="van-field__control"></textarea>
<div class="van-field__body"><textarea placeholder="请输入留言" rows="1" class="van-field__control"></textarea>
<!---->
<!---->
<!---->
@ -148,15 +136,12 @@ exports[`renders demo correctly 1`] = `
<!---->
</div>
<div class="van-cell__value">
<div class="van-field__body">
<input type="text" placeholder="请输入短信验证码" value="" class="van-field__control">
<div class="van-field__body"><input type="text" placeholder="请输入短信验证码" value="" class="van-field__control">
<!---->
<!---->
<div class="van-field__button">
<button class="van-button van-button--primary van-button--small"><span class="van-button__text">
<div class="van-field__button"><button class="van-button van-button--primary van-button--small"><span class="van-button__text">
发送验证码
</span></button>
</div>
</span></button></div>
</div>
<!---->
</div>

View File

@ -5,8 +5,7 @@ exports[`clearable 1`] = `
<!---->
<!---->
<div class="van-cell__value van-cell__value--alone">
<div class="van-field__body">
<input type="text" class="van-field__control">
<div class="van-field__body"><input type="text" class="van-field__control">
<!---->
<!---->
<!---->
@ -22,12 +21,9 @@ exports[`clearable 2`] = `
<!---->
<!---->
<div class="van-cell__value van-cell__value--alone">
<div class="van-field__body">
<input type="text" class="van-field__control">
<i class="van-icon van-icon-clear van-field__clear">
<div class="van-field__body"><input type="text" class="van-field__control"> <i class="van-icon van-icon-clear van-field__clear">
<!---->
<!---->
</i>
<!----></i>
<!---->
<!---->
</div>
@ -42,8 +38,7 @@ exports[`render textarea 1`] = `
<!---->
<!---->
<div class="van-cell__value van-cell__value--alone">
<div class="van-field__body">
<textarea class="van-field__control" style="height: auto;"></textarea>
<div class="van-field__body"><textarea class="van-field__control" style="height: auto;"></textarea>
<!---->
<!---->
<!---->

View File

@ -1,4 +1,4 @@
import Field from '../';
import Field from '..';
import { mount, later } from '../../../test/utils';
test('input event', () => {
@ -55,7 +55,7 @@ test('keypress event', () => {
expect(calls.length).toBe(2);
});
test('render textarea', async() => {
test('render textarea', async () => {
const wrapper = mount(Field, {
propsData: {
type: 'textarea',
@ -82,7 +82,7 @@ test('autosize textarea field', () => {
expect(textarea.element.value).toEqual(value);
});
test('autosize object', async() => {
test('autosize object', async () => {
const wrapper = mount(Field, {
propsData: {
type: 'textarea',
@ -120,7 +120,7 @@ test('focus method', () => {
expect(fn.mock.calls.length).toEqual(1);
});
test('maxlength', async() => {
test('maxlength', async () => {
const wrapper = mount(Field, {
attrs: {
maxlength: 3

View File

@ -4,41 +4,28 @@ exports[`renders demo correctly 1`] = `
<div>
<div>
<div class="van-goods-action">
<div class="van-hairline van-goods-action-mini-btn">
<i class="van-icon van-icon-chat van-goods-action-mini-btn__icon" style="color:undefined;font-size:undefined;">
<div class="van-hairline van-goods-action-mini-btn"><i class="van-icon van-icon-chat van-goods-action-mini-btn__icon" style="color:undefined;font-size:undefined;">
<!---->
<!----></i> 客服</div>
<div class="van-hairline van-goods-action-mini-btn"><i class="van-icon van-icon-cart van-goods-action-mini-btn__icon" style="color:undefined;font-size:undefined;">
<!---->
</i> 客服</div>
<div class="van-hairline van-goods-action-mini-btn">
<i class="van-icon van-icon-cart van-goods-action-mini-btn__icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i> 购物车</div>
<button class="van-button van-button--warning van-button--large van-button--square van-goods-action-big-btn"><span class="van-button__text">加入购物车</span></button>
<button class="van-button van-button--danger van-button--large van-button--square van-goods-action-big-btn"><span class="van-button__text">立即购买</span></button>
<!----></i> 购物车</div> <button class="van-button van-button--warning van-button--large van-button--square van-goods-action-big-btn"><span class="van-button__text">加入购物车</span></button> <button class="van-button van-button--danger van-button--large van-button--square van-goods-action-big-btn"><span class="van-button__text">立即购买</span></button>
</div>
</div>
<div>
<div class="van-goods-action">
<div class="van-hairline van-goods-action-mini-btn">
<i class="van-icon van-icon-chat van-goods-action-mini-btn__icon" style="color:undefined;font-size:undefined;">
<div class="van-hairline van-goods-action-mini-btn"><i class="van-icon van-icon-chat van-goods-action-mini-btn__icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i> 客服</div>
<div class="van-hairline van-goods-action-mini-btn">
<i class="van-icon van-icon-cart van-goods-action-mini-btn__icon" style="color:undefined;font-size:undefined;">
<!----></i> 客服</div>
<div class="van-hairline van-goods-action-mini-btn"><i class="van-icon van-icon-cart van-goods-action-mini-btn__icon" style="color:undefined;font-size:undefined;">
<!---->
<div class="van-info">
5
</div>
</i> 购物车</div>
<div class="van-hairline van-goods-action-mini-btn">
<i class="van-icon van-icon-shop van-goods-action-mini-btn__icon" style="color:undefined;font-size:undefined;">
<div class="van-hairline van-goods-action-mini-btn"><i class="van-icon van-icon-shop van-goods-action-mini-btn__icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i> 店铺</div>
<button class="van-button van-button--warning van-button--large van-button--square van-goods-action-big-btn"><span class="van-button__text">加入购物车</span></button>
<button class="van-button van-button--danger van-button--large van-button--square van-goods-action-big-btn"><span class="van-button__text">立即购买</span></button>
<!----></i> 店铺</div> <button class="van-button van-button--warning van-button--large van-button--square van-goods-action-big-btn"><span class="van-button__text">加入购物车</span></button> <button class="van-button van-button--danger van-button--large van-button--square van-goods-action-big-btn"><span class="van-button__text">立即购买</span></button>
</div>
</div>
</div>

View File

@ -1,9 +1,7 @@
module.exports = (fontName, ttf) => {
return `@font-face {
module.exports = (fontName, ttf) => `@font-face {
font-style: normal;
font-weight: normal;
font-family: '${fontName}';
src: url('./${ttf}') format('truetype');
}
`;
};

View File

@ -39,7 +39,7 @@
</template>
<script>
import icons from '../../../packages/icon/config';
import icons from '../config';
export default {
i18n: {

View File

@ -15,7 +15,7 @@
</template>
<script>
import { ImagePreview } from '../../../packages';
import { ImagePreview } from '../..';
const images = [
'https://img.yzcdn.cn/public_files/2017/09/05/3bd347e44233a868c99cf0fe560232be.jpg',

View File

@ -6,16 +6,10 @@ exports[`render image 1`] = `
1/3
</div>
<div class="van-swipe">
<div class="van-swipe__track" style="width: 0px;">
<div class="van-swipe-item" style="width: 0px; height: 100%;">
<img src="https://img.yzcdn.cn/1.png" class="van-image-preview__image">
</div>
<div class="van-swipe-item" style="width: 0px; height: 100%;">
<img src="https://img.yzcdn.cn/2.png" class="van-image-preview__image">
</div>
<div class="van-swipe-item" style="width: 0px; height: 100%;">
<img src="https://img.yzcdn.cn/3.png" class="van-image-preview__image">
</div>
<div class="van-swipe__track" style="width: 0px; transform: translateX(0px);">
<div class="van-swipe-item" style="width: 0px; height: 100%; transform: translateX(0px);"><img src="https://img.yzcdn.cn/1.png" class="van-image-preview__image"></div>
<div class="van-swipe-item" style="width: 0px; height: 100%; transform: translateX(0px);"><img src="https://img.yzcdn.cn/2.png" class="van-image-preview__image"></div>
<div class="van-swipe-item" style="width: 0px; height: 100%; transform: translateX(0px);"><img src="https://img.yzcdn.cn/3.png" class="van-image-preview__image"></div>
</div>
<!---->
</div>
@ -28,16 +22,10 @@ exports[`zoom 1`] = `
1/3
</div>
<div class="van-swipe">
<div class="van-swipe__track" style="width: 300px;">
<div class="van-swipe-item" style="width: 100px; height: 100%;">
<img src="https://img.yzcdn.cn/1.png" class="van-image-preview__image">
</div>
<div class="van-swipe-item" style="width: 100px; height: 100%;">
<img src="https://img.yzcdn.cn/2.png" class="van-image-preview__image">
</div>
<div class="van-swipe-item" style="width: 100px; height: 100%;">
<img src="https://img.yzcdn.cn/3.png" class="van-image-preview__image">
</div>
<div class="van-swipe__track" style="width: 300px; transform: translateX(0px);">
<div class="van-swipe-item" style="width: 100px; height: 100%; transform: translateX(0px);"><img src="https://img.yzcdn.cn/1.png" class="van-image-preview__image" style="transform: scale3d(2, 2, 1) translate(0px, NaNpx);"></div>
<div class="van-swipe-item" style="width: 100px; height: 100%; transform: translateX(0px);"><img src="https://img.yzcdn.cn/2.png" class="van-image-preview__image"></div>
<div class="van-swipe-item" style="width: 100px; height: 100%; transform: translateX(0px);"><img src="https://img.yzcdn.cn/3.png" class="van-image-preview__image"></div>
</div>
<!---->
</div>

View File

@ -96,8 +96,8 @@ test('register component', () => {
expect(Vue.component(ImagePreviewVue.name)).toBeTruthy();
});
test('zoom', async() => {
const getBoundingClientRect = Element.prototype.getBoundingClientRect;
test('zoom', async () => {
const { getBoundingClientRect } = Element.prototype;
Element.prototype.getBoundingClientRect = jest.fn(() => ({ width: 100 }));
const wrapper = mount(ImagePreviewVue, {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
// This file is auto gererated by build/build-entry.js
import Actionsheet from './actionsheet';
import AddressEdit from './address-edit';

View File

@ -9,7 +9,7 @@ function mockOffsetParent(el) {
});
}
test('load event', async() => {
test('load event', async () => {
const wrapper = mount(List);
wrapper.vm.$on('input', value => {
@ -29,7 +29,7 @@ test('load event', async() => {
wrapper.destroy();
});
test('finished', async() => {
test('finished', async () => {
const wrapper = mount(List, {
propsData: {
finished: true
@ -48,7 +48,7 @@ test('finished', async() => {
expect(wrapper.emitted('input')).toBeTruthy();
});
test('immediate check false', async() => {
test('immediate check false', async () => {
const wrapper = mount(List, {
propsData: {
immediateCheck: false

View File

@ -4,8 +4,7 @@ exports[`renders demo correctly 1`] = `
<div>
<div>
<div class="van-loading van-loading--circular van-loading" style="color:#c9c9c9;width:undefined;height:undefined;"><span class="van-loading__spinner van-loading__spinner--circular"> <svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div>
<div class="van-loading van-loading--circular van-loading--white"
style="color:white;width:undefined;height:undefined;"><span class="van-loading__spinner van-loading__spinner--circular"> <svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div>
<div class="van-loading van-loading--circular van-loading--white" style="color:white;width:undefined;height:undefined;"><span class="van-loading__spinner van-loading__spinner--circular"> <svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div>
</div>
<div>
<div class="van-loading van-loading--spinner van-loading" style="color:#c9c9c9;width:undefined;height:undefined;"><span class="van-loading__spinner van-loading__spinner--spinner"><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i> <!----></span></div>

View File

@ -10,7 +10,7 @@
const ELEMENT = '__';
const MODS = '--';
const join = (name, el, symbol) => el ? name + symbol + el : name;
const join = (name, el, symbol) => (el ? name + symbol + el : name);
const prefix = (name, mods) => {
if (typeof mods === 'string') {

View File

@ -17,7 +17,7 @@ export default {
const messages = this.$vantMessages[this.$vantLang];
return (path, ...args) => {
const message = get(messages, prefix + path) || get(messages, path);
return typeof message === 'function' ? message.apply(null, args) : message;
return typeof message === 'function' ? message(...args) : message;
};
}
}

View File

@ -4,29 +4,22 @@ exports[`renders demo correctly 1`] = `
<div>
<div>
<div class="van-nav-bar van-hairline--bottom" style="z-index:1;">
<div class="van-nav-bar__left">
<i class="van-icon van-icon-arrow-left van-nav-bar__arrow" style="color:undefined;font-size:undefined;">
<div class="van-nav-bar__left"><i class="van-icon van-icon-arrow-left van-nav-bar__arrow" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i> <span class="van-nav-bar__text">返回</span></div>
<!----></i> <span class="van-nav-bar__text">返回</span></div>
<div class="van-ellipsis van-nav-bar__title">标题</div>
<div class="van-nav-bar__right"><span class="van-nav-bar__text">按钮</span></div>
</div>
</div>
<div>
<div class="van-nav-bar van-hairline--bottom" style="z-index:1;">
<div class="van-nav-bar__left">
<i class="van-icon van-icon-arrow-left van-nav-bar__arrow" style="color:undefined;font-size:undefined;">
<div class="van-nav-bar__left"><i class="van-icon van-icon-arrow-left van-nav-bar__arrow" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i> <span class="van-nav-bar__text">返回</span></div>
<!----></i> <span class="van-nav-bar__text">返回</span></div>
<div class="van-ellipsis van-nav-bar__title">标题</div>
<div class="van-nav-bar__right">
<i class="van-icon van-icon-search" style="color:undefined;font-size:undefined;">
<div class="van-nav-bar__right"><i class="van-icon van-icon-search" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
</div>
<!----></i></div>
</div>
</div>
</div>

View File

@ -9,7 +9,7 @@
v-if="leftIcon"
:class="b('left-icon')"
>
<img :src="leftIcon" >
<img :src="leftIcon">
</div>
<div
ref="wrap"

View File

@ -4,9 +4,7 @@ exports[`renders demo correctly 1`] = `
<div>
<div>
<div class="van-notice-bar" style="color:undefined;background:undefined;">
<div class="van-notice-bar__left-icon">
<img src="//img.yzcdn.cn/vant/volume.png">
</div>
<div class="van-notice-bar__left-icon"><img src="//img.yzcdn.cn/vant/volume.png"></div>
<div class="van-notice-bar__wrap">
<div class="van-notice-bar__content" style="padding-left:0;animation-delay:1s;animation-duration:0s;">足协杯战线连续第2年上演广州德比战上赛季半决赛上恒大以两回合5-3的总比分淘汰富力。</div>
</div>
@ -27,21 +25,17 @@ exports[`renders demo correctly 1`] = `
<!---->
<div class="van-notice-bar__wrap">
<div class="van-notice-bar__content" style="padding-left:0;animation-delay:1s;animation-duration:0s;">足协杯战线连续第2年上演广州德比战上赛季半决赛上恒大以两回合5-3的总比分淘汰富力。</div>
</div>
<i class="van-icon van-icon-close van-notice-bar__right-icon" style="color:undefined;font-size:undefined;">
</div> <i class="van-icon van-icon-close van-notice-bar__right-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
<div class="van-notice-bar van-notice-bar--withicon" style="color:undefined;background:undefined;">
<!---->
<div class="van-notice-bar__wrap">
<div class="van-notice-bar__content" style="padding-left:0;animation-delay:1s;animation-duration:0s;">足协杯战线连续第2年上演广州德比战上赛季半决赛上恒大以两回合5-3的总比分淘汰富力。</div>
</div>
<i class="van-icon van-icon-arrow van-notice-bar__right-icon" style="color:undefined;font-size:undefined;">
</div> <i class="van-icon van-icon-arrow van-notice-bar__right-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
</div>
</div>
</div>

View File

@ -2,11 +2,7 @@
exports[`renders demo correctly 1`] = `
<div>
<div>
<button class="van-button van-button--default van-button--normal"><span class="van-button__text">显示消息通知</span></button>
</div>
<div>
<button class="van-button van-button--default van-button--normal"><span class="van-button__text">显示自定义消息通知</span></button>
</div>
<div><button class="van-button van-button--default van-button--normal"><span class="van-button__text">显示消息通知</span></button></div>
<div><button class="van-button van-button--default van-button--normal"><span class="van-button__text">显示自定义消息通知</span></button></div>
</div>
`;

View File

@ -1,9 +1,9 @@
import Notify from '../';
import Notify from '..';
import { transitionStub, later } from '../../../test/utils';
transitionStub();
test('create a notify', async() => {
test('create a notify', async () => {
// should not cause error when call clear before show notify
Notify.clear();
@ -13,7 +13,7 @@ test('create a notify', async() => {
expect(notify.$el.outerHTML).toMatchSnapshot();
});
test('notify disappear', async() => {
test('notify disappear', async () => {
const notify = Notify({
message: 'test',
color: 'red',

View File

@ -2,52 +2,22 @@
exports[`renders demo correctly 1`] = `
<div>
<div>
<button class="van-button van-button--default van-button--normal"><span class="van-button__text">
<div><button class="van-button van-button--default van-button--normal"><span class="van-button__text">
弹出默认键盘
</span></button>
<div name="van-slide-up" class="van-number-keyboard van-number-keyboard--default" style="z-index:100;">
<div class="van-hairline--top van-number-keyboard__title"><span></span> <span class="van-number-keyboard__close">完成</span></div>
<div class="van-number-keyboard__body">
<i class="van-hairline van-key">1</i>
<i class="van-hairline van-key">2</i>
<i class="van-hairline van-key">3</i>
<i class="van-hairline van-key">4</i>
<i class="van-hairline van-key">5</i>
<i class="van-hairline van-key">6</i>
<i class="van-hairline van-key">7</i>
<i class="van-hairline van-key">8</i>
<i class="van-hairline van-key">9</i>
<i class="van-hairline van-key van-key--gray">.</i>
<i class="van-hairline van-key">0</i>
<i class="van-hairline van-key van-key--gray van-key--delete">删除</i>
</div>
<div class="van-number-keyboard__body"><i class="van-hairline van-key">1</i><i class="van-hairline van-key">2</i><i class="van-hairline van-key">3</i><i class="van-hairline van-key">4</i><i class="van-hairline van-key">5</i><i class="van-hairline van-key">6</i><i class="van-hairline van-key">7</i><i class="van-hairline van-key">8</i><i class="van-hairline van-key">9</i><i class="van-hairline van-key van-key--gray">.</i><i class="van-hairline van-key">0</i><i class="van-hairline van-key van-key--gray van-key--delete">删除</i></div>
<!---->
</div>
</div>
<div>
<button class="van-button van-button--default van-button--normal"><span class="van-button__text">
<div><button class="van-button van-button--default van-button--normal"><span class="van-button__text">
弹出自定义键盘
</span></button>
<div name="van-slide-up" class="van-number-keyboard van-number-keyboard--custom" style="z-index:100;display:none;">
<!---->
<div class="van-number-keyboard__body">
<i class="van-hairline van-key">1</i>
<i class="van-hairline van-key">2</i>
<i class="van-hairline van-key">3</i>
<i class="van-hairline van-key">4</i>
<i class="van-hairline van-key">5</i>
<i class="van-hairline van-key">6</i>
<i class="van-hairline van-key">7</i>
<i class="van-hairline van-key">8</i>
<i class="van-hairline van-key">9</i>
<i class="van-hairline van-key van-key--middle">0</i>
<i class="van-hairline van-key">.</i>
</div>
<div class="van-number-keyboard__sidebar">
<i class="van-hairline van-key van-key--delete van-key--big van-key--gray">删除</i>
<i class="van-hairline van-key van-key--blue van-key--big">完成</i>
</div>
<div class="van-number-keyboard__body"><i class="van-hairline van-key">1</i><i class="van-hairline van-key">2</i><i class="van-hairline van-key">3</i><i class="van-hairline van-key">4</i><i class="van-hairline van-key">5</i><i class="van-hairline van-key">6</i><i class="van-hairline van-key">7</i><i class="van-hairline van-key">8</i><i class="van-hairline van-key">9</i><i class="van-hairline van-key van-key--middle">0</i><i class="van-hairline van-key">.</i></div>
<div class="van-number-keyboard__sidebar"><i class="van-hairline van-key van-key--delete van-key--big van-key--gray">删除</i> <i class="van-hairline van-key van-key--blue van-key--big">完成</i></div>
</div>
</div>
</div>

View File

@ -1,4 +1,4 @@
import NumberKeyboard from '../';
import NumberKeyboard from '..';
import { mount } from '../../../test/utils';
function mockTouch(wrapper, event, keyIndex) {

View File

@ -5,8 +5,8 @@
v-model="currentPage1"
:total-items="24"
:items-per-page="5"
:prev-text= "$t('prevText')"
:next-text= "$t('nextText')"
:prev-text="$t('prevText')"
:next-text="$t('nextText')"
/>
</demo-block>
@ -14,8 +14,8 @@
<van-pagination
v-model="currentPage2"
:page-count="12"
:prev-text= "$t('prevText')"
:next-text= "$t('nextText')"
:prev-text="$t('prevText')"
:next-text="$t('nextText')"
mode="simple"
size="small"
/>
@ -27,8 +27,8 @@
v-model="currentPage3"
:total-items="125"
:show-page-size="3"
:prev-text= "$t('prevText')"
:next-text= "$t('nextText')"
:prev-text="$t('prevText')"
:next-text="$t('nextText')"
/>
</demo-block>
</demo-section>

View File

@ -32,12 +32,9 @@ exports[`renders demo correctly 1`] = `
<div>内容</div>
</div>
<div class="van-hairline--top van-panel__footer">
<div>
<button class="van-button van-button--default van-button--small"><span class="van-button__text">按钮</span></button>
<button class="van-button van-button--danger van-button--small"><span class="van-button__text">
<div><button class="van-button van-button--default van-button--small"><span class="van-button__text">按钮</span></button> <button class="van-button van-button--danger van-button--small"><span class="van-button__text">
按钮
</span></button>
</div>
</span></button></div>
</div>
</div>
</div>

View File

@ -5,43 +5,18 @@ exports[`renders demo correctly 1`] = `
<div>
<div class="van-password-input">
<ul class="van-hairline--surround van-password-input__security">
<li class="van-hairline">
<i style="visibility:visible;"></i>
</li>
<li class="van-hairline">
<i style="visibility:visible;"></i>
</li>
<li class="van-hairline">
<i style="visibility:visible;"></i>
</li>
<li class="van-hairline">
<i style="visibility:hidden;"></i>
</li>
<li class="van-hairline">
<i style="visibility:hidden;"></i>
</li>
<li class="van-hairline">
<i style="visibility:hidden;"></i>
</li>
<li class="van-hairline"><i style="visibility:visible;"></i></li>
<li class="van-hairline"><i style="visibility:visible;"></i></li>
<li class="van-hairline"><i style="visibility:visible;"></i></li>
<li class="van-hairline"><i style="visibility:hidden;"></i></li>
<li class="van-hairline"><i style="visibility:hidden;"></i></li>
<li class="van-hairline"><i style="visibility:hidden;"></i></li>
</ul>
<div class="van-password-input__info">密码为 6 位数字</div>
</div>
<div name="van-slide-up" class="van-number-keyboard van-number-keyboard--default" style="z-index:100;">
<!---->
<div class="van-number-keyboard__body">
<i class="van-hairline van-key">1</i>
<i class="van-hairline van-key">2</i>
<i class="van-hairline van-key">3</i>
<i class="van-hairline van-key">4</i>
<i class="van-hairline van-key">5</i>
<i class="van-hairline van-key">6</i>
<i class="van-hairline van-key">7</i>
<i class="van-hairline van-key">8</i>
<i class="van-hairline van-key">9</i>
<i class="van-hairline van-key van-key--gray"></i>
<i class="van-hairline van-key">0</i>
<i class="van-hairline van-key van-key--gray van-key--delete">删除</i>
</div>
<div class="van-number-keyboard__body"><i class="van-hairline van-key">1</i><i class="van-hairline van-key">2</i><i class="van-hairline van-key">3</i><i class="van-hairline van-key">4</i><i class="van-hairline van-key">5</i><i class="van-hairline van-key">6</i><i class="van-hairline van-key">7</i><i class="van-hairline van-key">8</i><i class="van-hairline van-key">9</i><i class="van-hairline van-key van-key--gray"></i><i class="van-hairline van-key">0</i><i class="van-hairline van-key van-key--gray van-key--delete">删除</i></div>
<!---->
</div>
</div>

View File

@ -113,8 +113,8 @@ export default create({
methods: {
setColumns() {
const columns = this.simple ? [{ values: this.columns }] : this.columns;
columns.forEach((columns, index) => {
this.setColumnValues(index, deepClone(columns.values));
columns.forEach((column, index) => {
this.setColumnValues(index, deepClone(column.values));
});
},

View File

@ -2,7 +2,7 @@
exports[`column watch default index 1`] = `
<div class="van-picker-column" style="height: 0px;">
<ul style="line-height: 50px;">
<ul style="transform: translate3d(0, -75px, 0); line-height: 50px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--disabled" style="height: 50px;">1</li>
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 50px;">1990</li>
<li class="van-ellipsis van-picker-column__item" style="height: 50px;">1991</li>
@ -16,7 +16,7 @@ exports[`column watch default index 1`] = `
exports[`column watch default index 2`] = `
<div class="van-picker-column" style="height: 0px;">
<ul style="line-height: 50px;">
<ul style="transform: translate3d(0, -125px, 0); line-height: 50px;">
<li class="van-ellipsis van-picker-column__item van-picker-column__item--disabled" style="height: 50px;">1</li>
<li class="van-ellipsis van-picker-column__item" style="height: 50px;">1990</li>
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 50px;">1991</li>

View File

@ -1,4 +1,4 @@
import Picker from '../';
import Picker from '..';
import PickerColumn from '../PickerColumn';
import { mount, triggerDrag, later } from '../../../test/utils';
@ -101,7 +101,7 @@ test('drag simple columns', () => {
expect(wrapper.emitted('change')[0][1]).toEqual('1992');
});
test('column watch default index', async() => {
test('column watch default index', async () => {
const disabled = { disabled: true, text: 1 };
const wrapper = mount(PickerColumn, {
propsData: {

View File

@ -2,16 +2,12 @@
exports[`renders demo correctly 1`] = `
<div>
<div>
<button class="van-button van-button--default van-button--normal"><span class="van-button__text">弹出 Popup</span></button>
<div><button class="van-button van-button--default van-button--normal"><span class="van-button__text">弹出 Popup</span></button>
<!---->
</div>
<div>
<button class="van-button van-button--default van-button--normal"><span class="van-button__text">底部弹出</span></button>
<!---->
<button class="van-button van-button--default van-button--normal"><span class="van-button__text">顶部弹出</span></button>
<!---->
<button class="van-button van-button--default van-button--normal"><span class="van-button__text">右侧弹出</span></button>
<div><button class="van-button van-button--default van-button--normal"><span class="van-button__text">底部弹出</span></button>
<!----> <button class="van-button van-button--default van-button--normal"><span class="van-button__text">顶部弹出</span></button>
<!----> <button class="van-button van-button--default van-button--normal"><span class="van-button__text">右侧弹出</span></button>
<!---->
</div>
</div>

View File

@ -1,4 +1,4 @@
import Popup from '../';
import Popup from '..';
import { mount, triggerDrag, transitionStub } from '../../../test/utils';
transitionStub();

View File

@ -5,28 +5,23 @@ exports[`renders demo correctly 1`] = `
<div>
<div class="van-progress"><span class="van-progress__portion van-progress__portion--with-pivot" style="width:0px;background:#1989fa;"><span class="van-progress__pivot" style="color:#fff;background:#1989fa;">
50%
</span></span>
</div>
</span></span></div>
</div>
<div>
<div class="van-progress"><span class="van-progress__portion van-progress__portion--with-pivot" style="width:0px;background:#cacaca;"><span class="van-progress__pivot" style="color:#fff;background:#cacaca;">
50%
</span></span>
</div>
</span></span></div>
</div>
<div>
<div class="van-progress"><span class="van-progress__portion van-progress__portion--with-pivot" style="width:0px;background:#f2826a;"><span class="van-progress__pivot" style="color:#fff;background:#f2826a;">
橙色
</span></span>
</div>
</span></span></div>
<div class="van-progress"><span class="van-progress__portion van-progress__portion--with-pivot" style="width:0px;background:#f44;"><span class="van-progress__pivot" style="color:#fff;background:#f44;">
红色
</span></span>
</div>
</span></span></div>
<div class="van-progress"><span class="van-progress__portion van-progress__portion--with-pivot" style="width:0px;background:linear-gradient(to right, #be99ff, #7232dd);"><span class="van-progress__pivot" style="color:#fff;background:#7232dd;">
紫色
</span></span>
</div>
</span></span></div>
</div>
</div>
`;

View File

@ -5,6 +5,5 @@ exports[`calc width 1`] = `<div class="van-progress"><span class="van-progress__
exports[`calc width 2`] = `
<div class="van-progress"><span class="van-progress__portion van-progress__portion--with-pivot" style="width: 0px; background: rgb(25, 137, 250);"><span class="van-progress__pivot" style="color: rgb(255, 255, 255); background: rgb(25, 137, 250);">
test
</span></span>
</div>
</span></span></div>
`;

View File

@ -1,4 +1,4 @@
import Progress from '../';
import Progress from '..';
import { mount } from '../../../test/utils';
test('calc width', () => {

View File

@ -2,9 +2,9 @@
exports[`change head content when pulling down 1`] = `
<div class="van-pull-refresh">
<div class="van-pull-refresh__track">
<div class="van-pull-refresh__track" style="transform: translate3d(0,20px, 0);">
<div class="van-pull-refresh__head">
<!----><span class="van-pull-refresh__text">下拉即可刷新...</span>
<!----> <span class="van-pull-refresh__text">下拉即可刷新...</span>
<!---->
<!---->
</div>
@ -14,10 +14,10 @@ exports[`change head content when pulling down 1`] = `
exports[`change head content when pulling down 2`] = `
<div class="van-pull-refresh">
<div class="van-pull-refresh__track">
<div class="van-pull-refresh__track" style="transform: translate3d(0,75px, 0);">
<div class="van-pull-refresh__head">
<!---->
<!----><span class="van-pull-refresh__text">释放即可刷新...</span>
<!----> <span class="van-pull-refresh__text">释放即可刷新...</span>
<!---->
</div>
</div>
@ -26,13 +26,14 @@ exports[`change head content when pulling down 2`] = `
exports[`change head content when pulling down 3`] = `
<div class="van-pull-refresh">
<div class="van-pull-refresh__track">
<div class="van-pull-refresh__track" style="transform: translate3d(0,50px, 0);">
<div class="van-pull-refresh__head">
<!---->
<!---->
<!---->
<div class="van-pull-refresh__loading">
<div class="van-loading van-loading--circular van-loading" style="color: rgb(201, 201, 201);"><span class="van-loading__spinner van-loading__spinner--circular"> <svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div> <span>加载中...</span></div>
<div class="van-loading van-loading--circular van-loading" style="color: rgb(201, 201, 201);"><span class="van-loading__spinner van-loading__spinner--circular"> <svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div> <span>加载中...</span>
</div>
</div>
</div>
</div>
@ -40,13 +41,14 @@ exports[`change head content when pulling down 3`] = `
exports[`change head content when pulling down 4`] = `
<div class="van-pull-refresh">
<div class="van-pull-refresh__track">
<div class="van-pull-refresh__track" style="transform: translate3d(0,50px, 0);">
<div class="van-pull-refresh__head">
<!---->
<!---->
<!---->
<div class="van-pull-refresh__loading">
<div class="van-loading van-loading--circular van-loading" style="color: rgb(201, 201, 201);"><span class="van-loading__spinner van-loading__spinner--circular"> <svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div> <span>加载中...</span></div>
<div class="van-loading van-loading--circular van-loading" style="color: rgb(201, 201, 201);"><span class="van-loading__spinner van-loading__spinner--circular"> <svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div> <span>加载中...</span>
</div>
</div>
</div>
</div>
@ -54,7 +56,7 @@ exports[`change head content when pulling down 4`] = `
exports[`change head content when pulling down 5`] = `
<div class="van-pull-refresh">
<div class="van-pull-refresh__track">
<div class="van-pull-refresh__track" style="transform: translate3d(0,0px, 0);">
<div class="van-pull-refresh__head">
<!---->
<!---->
@ -66,7 +68,7 @@ exports[`change head content when pulling down 5`] = `
exports[`not in page top 1`] = `
<div class="van-pull-refresh">
<div class="van-pull-refresh__track">
<div class="van-pull-refresh__track" style="transform: translate3d(0,0px, 0);">
<div class="van-pull-refresh__head">
<!---->
<!---->

View File

@ -17,6 +17,7 @@
</template>
<script>
/* eslint-disable prefer-spread */
import create from '../utils/create';
export default create({

View File

@ -3,104 +3,58 @@
exports[`renders demo correctly 1`] = `
<div>
<div>
<div class="van-rate">
<i data-index="0" class="van-icon van-icon-star van-rate__item" style="color:#ffd21e;font-size:20px;">
<div class="van-rate"><i data-index="0" class="van-icon van-icon-star van-rate__item" style="color:#ffd21e;font-size:20px;">
<!---->
<!----></i><i data-index="1" class="van-icon van-icon-star van-rate__item" style="color:#ffd21e;font-size:20px;">
<!---->
</i>
<i data-index="1" class="van-icon van-icon-star van-rate__item" style="color:#ffd21e;font-size:20px;">
<!----></i><i data-index="2" class="van-icon van-icon-star van-rate__item" style="color:#ffd21e;font-size:20px;">
<!---->
<!----></i><i data-index="3" class="van-icon van-icon-star-o van-rate__item" style="color:#c7c7c7;font-size:20px;">
<!---->
</i>
<i data-index="2" class="van-icon van-icon-star van-rate__item" style="color:#ffd21e;font-size:20px;">
<!----></i><i data-index="4" class="van-icon van-icon-star-o van-rate__item" style="color:#c7c7c7;font-size:20px;">
<!---->
<!---->
</i>
<i data-index="3" class="van-icon van-icon-star-o van-rate__item" style="color:#c7c7c7;font-size:20px;">
<!---->
<!---->
</i>
<i data-index="4" class="van-icon van-icon-star-o van-rate__item" style="color:#c7c7c7;font-size:20px;">
<!---->
<!---->
</i>
</div>
<!----></i></div>
</div>
<div>
<div class="van-rate">
<i data-index="0" class="van-icon van-icon-like van-rate__item" style="color:#ffd21e;font-size:20px;">
<div class="van-rate"><i data-index="0" class="van-icon van-icon-like van-rate__item" style="color:#ffd21e;font-size:20px;">
<!---->
<!----></i><i data-index="1" class="van-icon van-icon-like van-rate__item" style="color:#ffd21e;font-size:20px;">
<!---->
</i>
<i data-index="1" class="van-icon van-icon-like van-rate__item" style="color:#ffd21e;font-size:20px;">
<!----></i><i data-index="2" class="van-icon van-icon-like van-rate__item" style="color:#ffd21e;font-size:20px;">
<!---->
<!----></i><i data-index="3" class="van-icon van-icon-like-o van-rate__item" style="color:#c7c7c7;font-size:20px;">
<!---->
</i>
<i data-index="2" class="van-icon van-icon-like van-rate__item" style="color:#ffd21e;font-size:20px;">
<!----></i><i data-index="4" class="van-icon van-icon-like-o van-rate__item" style="color:#c7c7c7;font-size:20px;">
<!---->
<!---->
</i>
<i data-index="3" class="van-icon van-icon-like-o van-rate__item" style="color:#c7c7c7;font-size:20px;">
<!---->
<!---->
</i>
<i data-index="4" class="van-icon van-icon-like-o van-rate__item" style="color:#c7c7c7;font-size:20px;">
<!---->
<!---->
</i>
</div>
<!----></i></div>
</div>
<div>
<div class="van-rate">
<i data-index="0" class="van-icon van-icon-star van-rate__item" style="color:#2ba;font-size:25px;">
<div class="van-rate"><i data-index="0" class="van-icon van-icon-star van-rate__item" style="color:#2ba;font-size:25px;">
<!---->
<!----></i><i data-index="1" class="van-icon van-icon-star van-rate__item" style="color:#2ba;font-size:25px;">
<!---->
</i>
<i data-index="1" class="van-icon van-icon-star van-rate__item" style="color:#2ba;font-size:25px;">
<!----></i><i data-index="2" class="van-icon van-icon-star van-rate__item" style="color:#2ba;font-size:25px;">
<!---->
<!----></i><i data-index="3" class="van-icon van-icon-star van-rate__item" style="color:#2ba;font-size:25px;">
<!---->
</i>
<i data-index="2" class="van-icon van-icon-star van-rate__item" style="color:#2ba;font-size:25px;">
<!----></i><i data-index="4" class="van-icon van-icon-star-o van-rate__item" style="color:#ceefe8;font-size:25px;">
<!---->
<!----></i><i data-index="5" class="van-icon van-icon-star-o van-rate__item" style="color:#ceefe8;font-size:25px;">
<!---->
</i>
<i data-index="3" class="van-icon van-icon-star van-rate__item" style="color:#2ba;font-size:25px;">
<!---->
<!---->
</i>
<i data-index="4" class="van-icon van-icon-star-o van-rate__item" style="color:#ceefe8;font-size:25px;">
<!---->
<!---->
</i>
<i data-index="5" class="van-icon van-icon-star-o van-rate__item" style="color:#ceefe8;font-size:25px;">
<!---->
<!---->
</i>
</div>
<!----></i></div>
</div>
<div>
<div class="van-rate">
<i data-index="0" class="van-icon van-icon-star van-rate__item" style="color:#bdbdbd;font-size:20px;">
<div class="van-rate"><i data-index="0" class="van-icon van-icon-star van-rate__item" style="color:#bdbdbd;font-size:20px;">
<!---->
<!----></i><i data-index="1" class="van-icon van-icon-star van-rate__item" style="color:#bdbdbd;font-size:20px;">
<!---->
</i>
<i data-index="1" class="van-icon van-icon-star van-rate__item" style="color:#bdbdbd;font-size:20px;">
<!----></i><i data-index="2" class="van-icon van-icon-star-o van-rate__item" style="color:#bdbdbd;font-size:20px;">
<!---->
<!----></i><i data-index="3" class="van-icon van-icon-star-o van-rate__item" style="color:#bdbdbd;font-size:20px;">
<!---->
</i>
<i data-index="2" class="van-icon van-icon-star-o van-rate__item" style="color:#bdbdbd;font-size:20px;">
<!----></i><i data-index="4" class="van-icon van-icon-star-o van-rate__item" style="color:#bdbdbd;font-size:20px;">
<!---->
<!---->
</i>
<i data-index="3" class="van-icon van-icon-star-o van-rate__item" style="color:#bdbdbd;font-size:20px;">
<!---->
<!---->
</i>
<i data-index="4" class="van-icon van-icon-star-o van-rate__item" style="color:#bdbdbd;font-size:20px;">
<!---->
<!---->
</i>
</div>
<!----></i></div>
</div>
</div>
`;

View File

@ -1,4 +1,4 @@
import Rate from '../';
import Rate from '..';
import { mount, triggerDrag } from '../../../test/utils';
test('change event', () => {
@ -23,7 +23,7 @@ test('touchmove', () => {
triggerDrag(wrapper, 100, 0);
const icons = wrapper.findAll('.van-icon');
document.elementFromPoint = function(x, y) {
document.elementFromPoint = function (x) {
const index = Math.round(x / 20);
if (index < icons.length) {
return icons.at(index).element;

View File

@ -4,15 +4,12 @@ exports[`renders demo correctly 1`] = `
<div>
<div>
<div class="van-search" style="background:#f2f2f2;">
<div placeholder="请输入搜索关键词" class="van-cell van-cell--borderless van-field">
<i class="van-icon van-icon-search van-cell__left-icon" style="color:undefined;font-size:undefined;">
<div placeholder="请输入搜索关键词" class="van-cell van-cell--borderless van-field"><i class="van-icon van-icon-search van-cell__left-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
<!---->
<div class="van-cell__value van-cell__value--alone">
<div class="van-field__body">
<input type="search" placeholder="请输入搜索关键词" value="" class="van-field__control">
<div class="van-field__body"><input type="search" placeholder="请输入搜索关键词" value="" class="van-field__control">
<!---->
<!---->
<!---->
@ -27,15 +24,12 @@ exports[`renders demo correctly 1`] = `
<div>
<form action="/">
<div class="van-search van-search--show-action" style="background:#f2f2f2;">
<div placeholder="请输入搜索关键词" class="van-cell van-cell--borderless van-field">
<i class="van-icon van-icon-search van-cell__left-icon" style="color:undefined;font-size:undefined;">
<div placeholder="请输入搜索关键词" class="van-cell van-cell--borderless van-field"><i class="van-icon van-icon-search van-cell__left-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
<!---->
<div class="van-cell__value van-cell__value--alone">
<div class="van-field__body">
<input type="search" placeholder="请输入搜索关键词" value="" class="van-field__control">
<div class="van-field__body"><input type="search" placeholder="请输入搜索关键词" value="" class="van-field__control">
<!---->
<!---->
<!---->
@ -52,15 +46,12 @@ exports[`renders demo correctly 1`] = `
</div>
<div>
<div class="van-search van-search--show-action" style="background:#f2f2f2;">
<div placeholder="请输入搜索关键词" class="van-cell van-cell--borderless van-field">
<i class="van-icon van-icon-search van-cell__left-icon" style="color:undefined;font-size:undefined;">
<div placeholder="请输入搜索关键词" class="van-cell van-cell--borderless van-field"><i class="van-icon van-icon-search van-cell__left-icon" style="color:undefined;font-size:undefined;">
<!---->
<!---->
</i>
<!----></i>
<!---->
<div class="van-cell__value van-cell__value--alone">
<div class="van-field__body">
<input type="search" placeholder="请输入搜索关键词" value="" class="van-field__control">
<div class="van-field__body"><input type="search" placeholder="请输入搜索关键词" value="" class="van-field__control">
<!---->
<!---->
<!---->

View File

@ -57,8 +57,8 @@
:sku-row="skuTreeItem"
>
<sku-row-item
v-for="(skuValue, index) in skuTreeItem.v"
:key="index"
v-for="(skuValue, valueIndex) in skuTreeItem.v"
:key="valueIndex"
:sku-key-str="skuTreeItem.k_s"
:sku-value="skuValue"
:sku-event-bus="skuEventBus"
@ -274,7 +274,8 @@ export default create({
price: Math.round(this.sku.price * 100),
stock_num: this.sku.stock_num
};
} else if (this.isSkuCombSelected) {
}
if (this.isSkuCombSelected) {
return getSkuComb(this.sku.list, this.selectedSku);
}
return null;
@ -295,7 +296,7 @@ export default create({
imageList() {
const imageList = [this.goods.picture];
if (this.skuTree.length > 0) {
const treeItem = this.skuTree.filter(treeItem => treeItem.k_s === 's1')[0] || {};
const treeItem = this.skuTree.filter(item => item.k_s === 's1')[0] || {};
if (!treeItem.v) {
return;
@ -406,9 +407,7 @@ export default create({
},
onPreviewImage(indexImage) {
const index = this.imageList.findIndex(image => {
return image === indexImage;
});
const index = this.imageList.findIndex(image => image === indexImage);
const cbParams = {
index,

View File

@ -7,7 +7,7 @@
:class="b('img-wrap')"
@click="previewImage"
>
<img :src="goodsImg" >
<img :src="goodsImg">
</div>
<div :class="b('goods-info')">
<div class="van-sku__goods-name van-ellipsis">{{ goods.title }}</div>
@ -49,7 +49,7 @@ export default create({
if (!id) return;
// skuImgskuTrees1sku
const treeItem = this.sku.tree.filter(treeItem => treeItem.k_s === 's1')[0] || {};
const treeItem = this.sku.tree.filter(item => item.k_s === 's1')[0] || {};
if (!treeItem.v) {
return;

View File

@ -98,7 +98,7 @@ export default create({
const messages = {};
this.messageValues.forEach((item, index) => {
let value = item.value;
let { value } = item;
if (this.messages[index].datetime > 0) {
value = value.replace(/T/g, ' ');
}
@ -112,7 +112,7 @@ export default create({
const messages = {};
this.messageValues.forEach((item, index) => {
let value = item.value;
let { value } = item;
const message = this.messages[index];
if (message.datetime > 0) {
value = value.replace(/T/g, ' ');
@ -132,7 +132,7 @@ export default create({
const values = this.messageValues;
for (let i = 0; i < values.length; i++) {
const value = values[i].value;
const { value } = values[i];
const message = this.messages[i];
if (value === '') {

View File

@ -116,7 +116,7 @@
<script>
import skuData from './data';
import { LIMIT_TYPE } from '../../../packages/sku/constants';
import { LIMIT_TYPE } from '../constants';
export default {
i18n: {
@ -145,9 +145,7 @@ export default {
s1: '30349',
s2: '1193'
},
customSkuValidator: (component) => {
return '请选择xxx';
},
customSkuValidator: () => '请选择xxx',
customStepperConfig: {
quotaText: '单次限购100件',
stockFormatter: (stock) => `剩余${stock}`,
@ -166,11 +164,9 @@ export default {
}
},
messageConfig: {
uploadImg: (file, img) => {
return new Promise(resolve => {
setTimeout(() => resolve(img), 1000);
});
},
uploadImg: (file, img) => new Promise(resolve => {
setTimeout(() => resolve(img), 1000);
}),
uploadMaxSize: 3
}
};

View File

@ -4,27 +4,21 @@ exports[`renders demo correctly 1`] = `
<div>
<div>
<div class="sku-container">
<!---->
<button class="van-button van-button--primary van-button--normal van-button--block"><span class="van-button__text">
<!----> <button class="van-button van-button--primary van-button--normal van-button--block"><span class="van-button__text">
基础用法
</span></button>
</div>
</span></button></div>
</div>
<div>
<div class="sku-container">
<!---->
<button class="van-button van-button--primary van-button--normal van-button--block"><span class="van-button__text">
<!----> <button class="van-button van-button--primary van-button--normal van-button--block"><span class="van-button__text">
自定义步进器相关配置
</span></button>
</div>
</span></button></div>
</div>
<div>
<div class="sku-container">
<!---->
<button class="van-button van-button--primary van-button--normal van-button--block"><span class="van-button__text">
<!----> <button class="van-button van-button--primary van-button--normal van-button--block"><span class="van-button__text">
高级用法
</span></button>
</div>
</span></button></div>
</div>
</div>
`;

View File

@ -34,7 +34,7 @@ import { UNSELECTED_SKU_VALUE_ID } from '../constants';
...
}
*/
export const normalizeSkuTree = (skuTree) => {
export const normalizeSkuTree = skuTree => {
const normalizedTree = {};
skuTree.forEach(treeItem => {
normalizedTree[treeItem.k_s] = treeItem.v;
@ -45,17 +45,19 @@ export const normalizeSkuTree = (skuTree) => {
// 判断是否所有的sku都已经选中
export const isAllSelected = (skuTree, selectedSku) => {
// 筛选selectedSku对象中key值不为空的值
const selected = Object.keys(selectedSku).filter(skuKeyStr => selectedSku[skuKeyStr] !== UNSELECTED_SKU_VALUE_ID);
const selected = Object.keys(selectedSku).filter(
skuKeyStr => selectedSku[skuKeyStr] !== UNSELECTED_SKU_VALUE_ID
);
return skuTree.length === selected.length;
};
// 根据已选择的sku获取skuComb
// 根据已选择的 sku 获取 skuComb
export const getSkuComb = (skuList, selectedSku) => {
const skuComb = skuList.filter(skuComb => {
return Object.keys(selectedSku).every(skuKeyStr => {
return String(skuComb[skuKeyStr]) === String(selectedSku[skuKeyStr]); // eslint-disable-line
});
});
const skuComb = skuList.filter(item => (
Object.keys(selectedSku).every(
skuKeyStr => String(item[skuKeyStr]) === String(selectedSku[skuKeyStr])
)
));
return skuComb[0];
};
@ -67,7 +69,7 @@ export const getSelectedSkuValues = (skuTree, selectedSku) => {
const skuValueId = selectedSku[skuKeyStr];
if (skuValueId !== UNSELECTED_SKU_VALUE_ID) {
const skuValue = skuValues.filter(skuValue => skuValue.id === skuValueId)[0];
const skuValue = skuValues.filter(value => value.id === skuValueId)[0];
skuValue && selectedValues.push(skuValue);
}
return selectedValues;
@ -77,19 +79,27 @@ export const getSelectedSkuValues = (skuTree, selectedSku) => {
// 判断sku是否可选
export const isSkuChoosable = (skuList, selectedSku, skuToChoose) => {
const { key, valueId } = skuToChoose;
// 先假设sku已选中拼入已选中sku对象中
const matchedSku = Object.assign({}, selectedSku, {
[key]: valueId
});
// 再判断剩余sku是否全部不可选若不可选则当前sku不可选中
const skusToCheck = Object.keys(matchedSku).filter(skuKey => matchedSku[skuKey] !== UNSELECTED_SKU_VALUE_ID);
const filteredSku = skuList.filter(sku => {
return skusToCheck.every(skuKey => {
return String(matchedSku[skuKey]) === String(sku[skuKey]);
});
});
const stock = filteredSku.reduce((total, sku) => (total += sku.stock_num), 0);
// 再判断剩余sku是否全部不可选若不可选则当前sku不可选中
const skusToCheck = Object.keys(matchedSku).filter(
skuKey => matchedSku[skuKey] !== UNSELECTED_SKU_VALUE_ID
);
const filteredSku = skuList.filter(sku => (
skusToCheck.every(
skuKey => String(matchedSku[skuKey]) === String(sku[skuKey])
)
));
const stock = filteredSku.reduce((total, sku) => {
total += sku.stock_num;
return total;
}, 0);
return stock > 0;
};

Some files were not shown because too many files have changed in this diff Show More