[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, "root": true,
"env": { "extends": ["@vant"]
"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"
}
]
}
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,11 +3,10 @@
*/ */
import Vue from 'vue'; 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 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'; import { camelize } from '../../packages/utils';
Vue Vue
@ -86,12 +85,12 @@ export function wrapper(promise, name) {
component = component.default; component = component.default;
name = 'demo-' + name; name = 'demo-' + name;
component.name = name; component.name = name;
const { i18n } = component; const { i18n: config } = component;
if (i18n) { if (config) {
const formattedI18n = {}; const formattedI18n = {};
const camelizedName = camelize(name); const camelizedName = camelize(name);
Object.keys(i18n).forEach(key => { Object.keys(config).forEach(key => {
formattedI18n[key] = { [camelizedName]: i18n[key] }; formattedI18n[key] = { [camelizedName]: config[key] };
}); });
Locale.add(formattedI18n); Locale.add(formattedI18n);
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -9,10 +9,10 @@ import './utils/iframe-router';
const registerRoute = (isDemo) => { const registerRoute = (isDemo) => {
const route = [{ const route = [{
path: '*', path: '*',
redirect: to => `/${Vue.prototype.$vantLang}/` redirect: () => `/${Vue.prototype.$vantLang}/`
}]; }];
Object.keys(docConfig).forEach((lang, index) => { Object.keys(docConfig).forEach((lang) => {
if (isDemo) { if (isDemo) {
route.push({ route.push({
path: `/${lang}`, 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) { function addRoute(page, lang) {
let { path } = page; let { path } = page;
if (path) { 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; return route;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -84,7 +84,7 @@ export default {
}, },
onEdit(item, index) { 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-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 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> </div> <i class="van-icon van-icon-edit van-address-item__edit" style="color:undefined;font-size:undefined;">
<i class="van-icon van-icon-edit van-address-item__edit" style="color:undefined;font-size:undefined;">
<!----> <!---->
<!----> <!----></i>
</i>
</div> </div>
<div class="van-cell van-cell--clickable van-address-item"> <div class="van-cell van-cell--clickable van-address-item">
<!----> <!---->
<!----> <!---->
<div class="van-cell__value van-cell__value--alone"> <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 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> </div> <i class="van-icon van-icon-edit van-address-item__edit" style="color:undefined;font-size:undefined;">
<i class="van-icon van-icon-edit van-address-item__edit" style="color:undefined;font-size:undefined;">
<!----> <!---->
<!----> <!----></i>
</i>
</div> </div>
</div> </div>
</div> </div>
@ -39,14 +35,11 @@ exports[`renders demo correctly 1`] = `
<!----> <!---->
<div class="van-cell__value van-cell__value--alone"> <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 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> </div> <i class="van-icon van-icon-edit van-address-item__edit" style="color:undefined;font-size:undefined;">
<i class="van-icon van-icon-edit van-address-item__edit" style="color:undefined;font-size:undefined;">
<!----> <!---->
<!----> <!----></i>
</i>
</div> </div>
</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>
<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> </div>
</div> </div>

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -93,9 +93,9 @@ export default create({
} }
const list = this[type]; const list = this[type];
result = Object.keys(list).map(code => ({ result = Object.keys(list).map(listCode => ({
code, code: listCode,
name: list[code] name: list[listCode]
})); }));
if (code) { if (code) {
@ -150,7 +150,7 @@ export default create({
picker.setColumnValues(1, city); picker.setColumnValues(1, city);
if (city.length && code.slice(2, 4) === '00') { if (city.length && code.slice(2, 4) === '00') {
code = city[0].code; [{ code }] = city;
} }
picker.setColumnValues(2, this.getList('county', code.slice(0, 4))); 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__columns" style="height: 220px;">
<div class="van-picker-column" 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>
<div class="van-picker-column" 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>
<div class="van-picker-column" 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>
<div class="van-hairline--top-bottom van-picker__frame" style="height: 44px;"></div> <div class="van-hairline--top-bottom van-picker__frame" style="height: 44px;"></div>
</div> </div>
@ -41,19 +41,19 @@ exports[`change option 2`] = `
<!----> <!---->
<div class="van-picker__columns" style="height: 220px;"> <div class="van-picker__columns" style="height: 220px;">
<div class="van-picker-column" 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" style="height: 44px;">北京市</li>
<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 van-picker-column__item--selected" style="height: 44px;">天津市</li>
</ul> </ul>
</div> </div>
<div class="van-picker-column" 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 van-picker-column__item--selected" style="height: 44px;">天津市</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">县</li> <li class="van-ellipsis van-picker-column__item" style="height: 44px;">县</li>
</ul> </ul>
</div> </div>
<div class="van-picker-column" 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 van-picker-column__item--selected" style="height: 44px;">和平区</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">河东区</li> <li class="van-ellipsis van-picker-column__item" style="height: 44px;">河东区</li>
</ul> </ul>
@ -77,19 +77,19 @@ exports[`change option 3`] = `
<!----> <!---->
<div class="van-picker__columns" style="height: 220px;"> <div class="van-picker__columns" style="height: 220px;">
<div class="van-picker-column" 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" style="height: 44px;">北京市</li>
<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 van-picker-column__item--selected" style="height: 44px;">天津市</li>
</ul> </ul>
</div> </div>
<div class="van-picker-column" 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 van-picker-column__item--selected" style="height: 44px;">天津市</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">县</li> <li class="van-ellipsis van-picker-column__item" style="height: 44px;">县</li>
</ul> </ul>
</div> </div>
<div class="van-picker-column" 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" style="height: 44px;">和平区</li>
<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 van-picker-column__item--selected" style="height: 44px;">河东区</li>
</ul> </ul>
@ -113,19 +113,19 @@ exports[`reset method 1`] = `
<!----> <!---->
<div class="van-picker__columns" style="height: 220px;"> <div class="van-picker__columns" style="height: 220px;">
<div class="van-picker-column" 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" style="height: 44px;">北京市</li>
<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 van-picker-column__item--selected" style="height: 44px;">天津市</li>
</ul> </ul>
</div> </div>
<div class="van-picker-column" 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" style="height: 44px;">天津市</li>
<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 van-picker-column__item--selected" style="height: 44px;">县</li>
</ul> </ul>
</div> </div>
<div class="van-picker-column" 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 van-picker-column__item--selected" style="height: 44px;">蓟县</li>
</ul> </ul>
</div> </div>
@ -148,19 +148,19 @@ exports[`reset method 2`] = `
<!----> <!---->
<div class="van-picker__columns" style="height: 220px;"> <div class="van-picker__columns" style="height: 220px;">
<div class="van-picker-column" 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 van-picker-column__item--selected" style="height: 44px;">北京市</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">天津市</li> <li class="van-ellipsis van-picker-column__item" style="height: 44px;">天津市</li>
</ul> </ul>
</div> </div>
<div class="van-picker-column" 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 van-picker-column__item--selected" style="height: 44px;">北京市</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">县</li> <li class="van-ellipsis van-picker-column__item" style="height: 44px;">县</li>
</ul> </ul>
</div> </div>
<div class="van-picker-column" 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 van-picker-column__item--selected" style="height: 44px;">东城区</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">西城区</li> <li class="van-ellipsis van-picker-column__item" style="height: 44px;">西城区</li>
</ul> </ul>
@ -184,13 +184,13 @@ exports[`watch areaList & code 1`] = `
<!----> <!---->
<div class="van-picker__columns" style="height: 220px;"> <div class="van-picker__columns" style="height: 220px;">
<div class="van-picker-column" 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>
<div class="van-picker-column" 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>
<div class="van-picker-column" 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>
<div class="van-hairline--top-bottom van-picker__frame" style="height: 44px;"></div> <div class="van-hairline--top-bottom van-picker__frame" style="height: 44px;"></div>
</div> </div>
@ -211,19 +211,19 @@ exports[`watch areaList & code 2`] = `
<!----> <!---->
<div class="van-picker__columns" style="height: 220px;"> <div class="van-picker__columns" style="height: 220px;">
<div class="van-picker-column" 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 van-picker-column__item--selected" style="height: 44px;">北京市</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">天津市</li> <li class="van-ellipsis van-picker-column__item" style="height: 44px;">天津市</li>
</ul> </ul>
</div> </div>
<div class="van-picker-column" 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 van-picker-column__item--selected" style="height: 44px;">北京市</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">县</li> <li class="van-ellipsis van-picker-column__item" style="height: 44px;">县</li>
</ul> </ul>
</div> </div>
<div class="van-picker-column" 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 van-picker-column__item--selected" style="height: 44px;">东城区</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">西城区</li> <li class="van-ellipsis van-picker-column__item" style="height: 44px;">西城区</li>
</ul> </ul>
@ -247,19 +247,19 @@ exports[`watch areaList & code 3`] = `
<!----> <!---->
<div class="van-picker__columns" style="height: 220px;"> <div class="van-picker__columns" style="height: 220px;">
<div class="van-picker-column" 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 van-picker-column__item--selected" style="height: 44px;">北京市</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">天津市</li> <li class="van-ellipsis van-picker-column__item" style="height: 44px;">天津市</li>
</ul> </ul>
</div> </div>
<div class="van-picker-column" 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 van-picker-column__item--selected" style="height: 44px;">北京市</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">县</li> <li class="van-ellipsis van-picker-column__item" style="height: 44px;">县</li>
</ul> </ul>
</div> </div>
<div class="van-picker-column" 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 van-picker-column__item--selected" style="height: 44px;">东城区</li>
<li class="van-ellipsis van-picker-column__item" style="height: 44px;">西城区</li> <li class="van-ellipsis van-picker-column__item" style="height: 44px;">西城区</li>
</ul> </ul>

View File

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

View File

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

View File

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

View File

@ -3,50 +3,28 @@
exports[`renders demo correctly 1`] = ` exports[`renders demo correctly 1`] = `
<div> <div>
<div> <div>
<div class="demo-button-row"> <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>
<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>
<div> <div><button class="van-button van-button--primary van-button--normal van-button--plain"><span class="van-button__text">
<button class="van-button van-button--primary van-button--normal van-button--plain"><span class="van-button__text">
朴素按钮 朴素按钮
</span></button> </span></button> <button class="van-button van-button--danger van-button--normal van-button--plain"><span class="van-button__text">
<button class="van-button van-button--danger van-button--normal van-button--plain"><span class="van-button__text">
朴素按钮 朴素按钮
</span></button> </span></button></div>
</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">
<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> </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">
<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> </span></button></div>
</div> <div><button class="van-button van-button--primary van-button--normal van-button--loading van-button--unclickable">
<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> <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> <button class="van-button van-button--danger van-button--normal van-button--loading van-button--unclickable">
<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> <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></div>
</div> <div><button class="van-button van-button--primary van-button--normal van-button--square"><span class="van-button__text">
<div>
<button class="van-button van-button--primary van-button--normal van-button--square"><span class="van-button__text">
方形按钮 方形按钮
</span></button> </span></button> <button class="van-button van-button--danger van-button--normal van-button--round"><span class="van-button__text">
<button class="van-button van-button--danger van-button--normal van-button--round"><span class="van-button__text">
圆形按钮 圆形按钮
</span></button> </span></button></div>
</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>
<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> </div>
`; `;

View File

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

View File

@ -3,11 +3,8 @@
exports[`renders demo correctly 1`] = ` exports[`renders demo correctly 1`] = `
<div> <div>
<div> <div>
<div class="van-card"> <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 href="javascript:;" class="van-card__thumb"> <!----></a>
<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__content">
<div class="van-card__left"> <div class="van-card__left">
<div class="van-card__title"> <div class="van-card__title">
@ -29,9 +26,7 @@ exports[`renders demo correctly 1`] = `
</div> </div>
</div> </div>
<div> <div>
<div class="van-card"> <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;">
<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;">
标签 标签
</span></a> </span></a>
<div class="van-card__content"> <div class="van-card__content">
@ -54,10 +49,7 @@ exports[`renders demo correctly 1`] = `
</div> </div>
</div> </div>
<div class="van-card__footer"> <div class="van-card__footer">
<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>
<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> </div>
</div> </div>

View File

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

View File

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

View File

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

View File

@ -3,24 +3,19 @@
exports[`renders demo correctly 1`] = ` exports[`renders demo correctly 1`] = `
<div> <div>
<div> <div>
<div class="van-circle" style="width:120px;height:120px;"> <div class="van-circle" style="width:120px;height:120px;"><svg viewBox="0 0 1060 1060">
<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__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> <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> </svg>
<div class="van-circle__text">0%</div> <div class="van-circle__text">0%</div>
</div> </div>
<div class="van-circle" style="width:120px;height:120px;"> <div class="van-circle" style="width:120px;height:120px;"><svg viewBox="0 0 1060 1060">
<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__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> <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> </svg>
<div class="van-circle__text">0%</div> <div class="van-circle__text">0%</div>
</div> </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>
<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>
</div> </div>
`; `;

View File

@ -116,7 +116,7 @@ export default create({
return; return;
} }
const contentHeight = content.clientHeight + 'px'; const contentHeight = `${content.clientHeight}px`;
wrapper.style.height = expanded ? 0 : contentHeight; wrapper.style.height = expanded ? 0 : contentHeight;
raf(() => { raf(() => {
wrapper.style.height = expanded ? contentHeight : 0; 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 class="van-cell__title"><span>有赞微商城</span>
<!----> <!---->
</div> </div>
<div class="van-cell__value"> </div> <div class="van-cell__value"> </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 class="van-collapse-item__wrapper"> <div class="van-collapse-item__wrapper">
<div class="van-collapse-item__content">提供多样店铺模板,快速搭建网上商城</div> <div class="van-collapse-item__content">提供多样店铺模板,快速搭建网上商城</div>
@ -26,11 +24,9 @@ exports[`renders demo correctly 1`] = `
<div class="van-cell__title"><span>有赞零售</span> <div class="van-cell__title"><span>有赞零售</span>
<!----> <!---->
</div> </div>
<div class="van-cell__value"> </div> <div class="van-cell__value"> </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>
@ -40,11 +36,9 @@ exports[`renders demo correctly 1`] = `
<div class="van-cell__title"><span>有赞美业</span> <div class="van-cell__title"><span>有赞美业</span>
<!----> <!---->
</div> </div>
<div class="van-cell__value"> </div> <div class="van-cell__value"> </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>
@ -58,11 +52,9 @@ exports[`renders demo correctly 1`] = `
<div class="van-cell__title"><span>有赞微商城</span> <div class="van-cell__title"><span>有赞微商城</span>
<!----> <!---->
</div> </div>
<div class="van-cell__value"> </div> <div class="van-cell__value"> </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 class="van-collapse-item__wrapper"> <div class="van-collapse-item__wrapper">
<div class="van-collapse-item__content">提供多样店铺模板,快速搭建网上商城</div> <div class="van-collapse-item__content">提供多样店铺模板,快速搭建网上商城</div>
@ -74,11 +66,9 @@ exports[`renders demo correctly 1`] = `
<div class="van-cell__title"><span>有赞零售</span> <div class="van-cell__title"><span>有赞零售</span>
<!----> <!---->
</div> </div>
<div class="van-cell__value"> </div> <div class="van-cell__value"> </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>
@ -88,11 +78,9 @@ exports[`renders demo correctly 1`] = `
<div class="van-cell__title"><span>有赞美业</span> <div class="van-cell__title"><span>有赞美业</span>
<!----> <!---->
</div> </div>
<div class="van-cell__value"> </div> <div class="van-cell__value"> </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>
@ -104,35 +92,26 @@ exports[`renders demo correctly 1`] = `
<div class="van-cell van-cell--clickable van-collapse-item__title"> <div class="van-cell van-cell--clickable van-collapse-item__title">
<!----> <!---->
<div class="van-cell__title"> <div class="van-cell__title">
<div>有赞微商城 <div>有赞微商城<i class="van-icon van-icon-question" style="color:undefined;font-size:undefined;">
<i class="van-icon van-icon-question" style="color:undefined;font-size:undefined;">
<!----> <!---->
<!----> <!----></i></div>
</i>
</div>
</div> </div>
<div class="van-cell__value"> </div> <div class="van-cell__value"> </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>
<div class="van-collapse-item van-hairline--top"> <div class="van-collapse-item van-hairline--top">
<div class="van-cell van-cell--clickable van-collapse-item__title"> <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 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 class="van-cell__title"><span>有赞零售</span>
<!----> <!---->
</div> </div>
<div class="van-cell__value"> </div> <div class="van-cell__value"> </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>

View File

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

View File

@ -3,17 +3,13 @@
exports[`renders demo correctly 1`] = ` exports[`renders demo correctly 1`] = `
<div> <div>
<div> <div>
<div class="van-cell van-cell--center van-cell--borderless van-cell--clickable van-contact-card van-contact-card--add"> <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 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> <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 class="van-icon van-icon-arrow van-cell__right-icon" style="color:undefined;font-size:undefined;">
<!----> <!---->
<!----> <!----></i>
</i>
</div> </div>
<div name="popup-slide-bottom" class="van-popup van-popup--bottom" style="display:none;"> <div name="popup-slide-bottom" class="van-popup van-popup--bottom" style="display:none;">
<div class="van-contact-list"> <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-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 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> </div> <i class="van-icon van-icon-edit van-contact-list__edit" style="color:undefined;font-size:undefined;">
<i class="van-icon van-icon-edit van-contact-list__edit" style="color:undefined;font-size:undefined;">
<!----> <!---->
<!----> <!----></i>
</i>
</div> </div>
</div> </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>
<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> </div>
<div name="popup-slide-bottom" class="van-popup van-popup--bottom" style="display:none;"> <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>
<div class="van-cell__value"> <div class="van-cell__value">
<div class="van-field__body"> <div class="van-field__body"><input type="text" maxlength="30" placeholder="请填写姓名" class="van-field__control">
<input type="text" maxlength="30" placeholder="请填写姓名" class="van-field__control">
<!----> <!---->
<!----> <!---->
<!----> <!---->
@ -60,8 +52,7 @@ exports[`renders demo correctly 1`] = `
<!----> <!---->
</div> </div>
<div class="van-cell__value"> <div class="van-cell__value">
<div class="van-field__body"> <div class="van-field__body"><input type="tel" placeholder="请填写电话" class="van-field__control">
<input type="tel" placeholder="请填写电话" class="van-field__control">
<!----> <!---->
<!----> <!---->
<!----> <!---->
@ -71,8 +62,7 @@ exports[`renders demo correctly 1`] = `
<!----> <!---->
</div> </div>
</div> </div>
<div class="van-contact-edit__buttons"> <div class="van-contact-edit__buttons"><button class="van-button van-button--danger van-button--normal van-button--block"><span class="van-button__text">
<button class="van-button van-button--danger van-button--normal van-button--block"><span class="van-button__text">
保存 保存
</span></button> </span></button>
<!----> <!---->
@ -81,11 +71,9 @@ exports[`renders demo correctly 1`] = `
</div> </div>
</div> </div>
<div> <div>
<div class="van-cell van-cell--center van-cell--borderless van-contact-card van-contact-card--edit"> <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 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 class="van-cell__value van-cell__value--alone">
<div>张三:张三</div> <div>张三:张三</div>

View File

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

View File

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

View File

@ -43,7 +43,7 @@
v-if="!coupons.length" v-if="!coupons.length"
:class="b('empty')" :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> <p>{{ $t('empty') }}</p>
</div> </div>
</div> </div>
@ -64,7 +64,7 @@
v-if="!disabledCoupons.length" v-if="!disabledCoupons.length"
:class="b('empty')" :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> <p>{{ $t('empty') }}</p>
</div> </div>
</div> </div>

View File

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

View File

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

View File

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

View File

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

View File

@ -1,399 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders demo correctly 1`] = ` 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>
`;

View File

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

View File

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

View File

@ -5,7 +5,7 @@ import { mount, later, transitionStub } from '../../../test/utils';
transitionStub(); transitionStub();
test('Dialog function call', async() => { test('Dialog function call', async () => {
Dialog.close(); Dialog.close();
Dialog.alert('1'); 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-cell__value van-cell__value--alone">
<div class="van-field__body"> <div class="van-field__body"><input type="text" placeholder="请输入用户名" value="" class="van-field__control">
<input type="text" placeholder="请输入用户名" value="" class="van-field__control">
<!----> <!---->
<!----> <!---->
<!----> <!---->
@ -28,15 +27,11 @@ exports[`renders demo correctly 1`] = `
<!----> <!---->
</div> </div>
<div class="van-cell__value"> <div class="van-cell__value">
<div class="van-field__body"> <div class="van-field__body"><input type="text" placeholder="请输入用户名" value="" class="van-field__control">
<input type="text" placeholder="请输入用户名" value="" class="van-field__control">
<!----> <!---->
<div class="van-field__icon"> <div class="van-field__icon"><i class="van-icon van-icon-question" style="color:undefined;font-size:undefined;">
<i class="van-icon van-icon-question" style="color:undefined;font-size:undefined;">
<!----> <!---->
<!----> <!----></i></div>
</i>
</div>
<!----> <!---->
</div> </div>
<!----> <!---->
@ -49,8 +44,7 @@ exports[`renders demo correctly 1`] = `
<!----> <!---->
</div> </div>
<div class="van-cell__value"> <div class="van-cell__value">
<div class="van-field__body"> <div class="van-field__body"><input type="password" placeholder="请输入密码" value="" class="van-field__control">
<input type="password" placeholder="请输入密码" value="" class="van-field__control">
<!----> <!---->
<!----> <!---->
<!----> <!---->
@ -63,17 +57,14 @@ exports[`renders demo correctly 1`] = `
</div> </div>
<div> <div>
<div class="van-cell-group van-hairline--top-bottom"> <div class="van-cell-group van-hairline--top-bottom">
<div disabled="disabled" class="van-cell van-field"> <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 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 class="van-cell__title"><span>用户名</span>
<!----> <!---->
</div> </div>
<div class="van-cell__value"> <div class="van-cell__value">
<div class="van-field__body"> <div class="van-field__body"><input type="text" disabled="disabled" value="输入框已禁用" class="van-field__control">
<input type="text" disabled="disabled" value="输入框已禁用" class="van-field__control">
<!----> <!---->
<!----> <!---->
<!----> <!---->
@ -92,8 +83,7 @@ exports[`renders demo correctly 1`] = `
<!----> <!---->
</div> </div>
<div class="van-cell__value"> <div class="van-cell__value">
<div class="van-field__body"> <div class="van-field__body"><input type="text" placeholder="请输入用户名" value="" class="van-field__control">
<input type="text" placeholder="请输入用户名" value="" class="van-field__control">
<!----> <!---->
<!----> <!---->
<!----> <!---->
@ -108,8 +98,7 @@ exports[`renders demo correctly 1`] = `
<!----> <!---->
</div> </div>
<div class="van-cell__value"> <div class="van-cell__value">
<div class="van-field__body"> <div class="van-field__body"><input type="text" placeholder="请输入手机号" value="1365577" class="van-field__control">
<input type="text" placeholder="请输入手机号" value="1365577" class="van-field__control">
<!----> <!---->
<!----> <!---->
<!----> <!---->
@ -128,8 +117,7 @@ exports[`renders demo correctly 1`] = `
<!----> <!---->
</div> </div>
<div class="van-cell__value"> <div class="van-cell__value">
<div class="van-field__body"> <div class="van-field__body"><textarea placeholder="请输入留言" rows="1" class="van-field__control"></textarea>
<textarea placeholder="请输入留言" rows="1" class="van-field__control"></textarea>
<!----> <!---->
<!----> <!---->
<!----> <!---->
@ -148,15 +136,12 @@ exports[`renders demo correctly 1`] = `
<!----> <!---->
</div> </div>
<div class="van-cell__value"> <div class="van-cell__value">
<div class="van-field__body"> <div class="van-field__body"><input type="text" placeholder="请输入短信验证码" value="" class="van-field__control">
<input type="text" placeholder="请输入短信验证码" value="" class="van-field__control">
<!----> <!---->
<!----> <!---->
<div class="van-field__button"> <div class="van-field__button"><button class="van-button van-button--primary van-button--small"><span class="van-button__text">
<button class="van-button van-button--primary van-button--small"><span class="van-button__text">
发送验证码 发送验证码
</span></button> </span></button></div>
</div>
</div> </div>
<!----> <!---->
</div> </div>

View File

@ -5,8 +5,7 @@ exports[`clearable 1`] = `
<!----> <!---->
<!----> <!---->
<div class="van-cell__value van-cell__value--alone"> <div class="van-cell__value van-cell__value--alone">
<div class="van-field__body"> <div class="van-field__body"><input type="text" class="van-field__control">
<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-cell__value van-cell__value--alone">
<div class="van-field__body"> <div class="van-field__body"><input type="text" class="van-field__control"> <i class="van-icon van-icon-clear van-field__clear">
<input type="text" class="van-field__control">
<i class="van-icon van-icon-clear van-field__clear">
<!----> <!---->
<!----> <!----></i>
</i>
<!----> <!---->
<!----> <!---->
</div> </div>
@ -42,8 +38,7 @@ exports[`render textarea 1`] = `
<!----> <!---->
<!----> <!---->
<div class="van-cell__value van-cell__value--alone"> <div class="van-cell__value van-cell__value--alone">
<div class="van-field__body"> <div class="van-field__body"><textarea class="van-field__control" style="height: auto;"></textarea>
<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'; import { mount, later } from '../../../test/utils';
test('input event', () => { test('input event', () => {
@ -55,7 +55,7 @@ test('keypress event', () => {
expect(calls.length).toBe(2); expect(calls.length).toBe(2);
}); });
test('render textarea', async() => { test('render textarea', async () => {
const wrapper = mount(Field, { const wrapper = mount(Field, {
propsData: { propsData: {
type: 'textarea', type: 'textarea',
@ -82,7 +82,7 @@ test('autosize textarea field', () => {
expect(textarea.element.value).toEqual(value); expect(textarea.element.value).toEqual(value);
}); });
test('autosize object', async() => { test('autosize object', async () => {
const wrapper = mount(Field, { const wrapper = mount(Field, {
propsData: { propsData: {
type: 'textarea', type: 'textarea',
@ -120,7 +120,7 @@ test('focus method', () => {
expect(fn.mock.calls.length).toEqual(1); expect(fn.mock.calls.length).toEqual(1);
}); });
test('maxlength', async() => { test('maxlength', async () => {
const wrapper = mount(Field, { const wrapper = mount(Field, {
attrs: { attrs: {
maxlength: 3 maxlength: 3

View File

@ -4,41 +4,28 @@ exports[`renders demo correctly 1`] = `
<div> <div>
<div> <div>
<div class="van-goods-action"> <div class="van-goods-action">
<div class="van-hairline van-goods-action-mini-btn"> <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 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> <!----></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 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>
</div> </div>
</div> </div>
<div> <div>
<div class="van-goods-action"> <div class="van-goods-action">
<div class="van-hairline van-goods-action-mini-btn"> <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 class="van-icon van-icon-chat van-goods-action-mini-btn__icon" style="color:undefined;font-size:undefined;">
<!----> <!---->
<!----> <!----></i> 客服</div>
</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-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"> <div class="van-info">
5 5
</div> </div>
</i> 购物车</div> </i> 购物车</div>
<div class="van-hairline van-goods-action-mini-btn"> <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 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> </div>
</div> </div>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,4 @@
/* eslint-disable */
// This file is auto gererated by build/build-entry.js // This file is auto gererated by build/build-entry.js
import Actionsheet from './actionsheet'; import Actionsheet from './actionsheet';
import AddressEdit from './address-edit'; 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); const wrapper = mount(List);
wrapper.vm.$on('input', value => { wrapper.vm.$on('input', value => {
@ -29,7 +29,7 @@ test('load event', async() => {
wrapper.destroy(); wrapper.destroy();
}); });
test('finished', async() => { test('finished', async () => {
const wrapper = mount(List, { const wrapper = mount(List, {
propsData: { propsData: {
finished: true finished: true
@ -48,7 +48,7 @@ test('finished', async() => {
expect(wrapper.emitted('input')).toBeTruthy(); expect(wrapper.emitted('input')).toBeTruthy();
}); });
test('immediate check false', async() => { test('immediate check false', async () => {
const wrapper = mount(List, { const wrapper = mount(List, {
propsData: { propsData: {
immediateCheck: false immediateCheck: false

View File

@ -4,8 +4,7 @@ exports[`renders demo correctly 1`] = `
<div> <div>
<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" 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" <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>
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> <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> <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 ELEMENT = '__';
const MODS = '--'; 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) => { const prefix = (name, mods) => {
if (typeof mods === 'string') { if (typeof mods === 'string') {

View File

@ -17,7 +17,7 @@ export default {
const messages = this.$vantMessages[this.$vantLang]; const messages = this.$vantMessages[this.$vantLang];
return (path, ...args) => { return (path, ...args) => {
const message = get(messages, prefix + path) || get(messages, path); 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> <div>
<div class="van-nav-bar van-hairline--bottom" style="z-index:1;"> <div class="van-nav-bar van-hairline--bottom" style="z-index:1;">
<div class="van-nav-bar__left"> <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 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-ellipsis van-nav-bar__title">标题</div>
<div class="van-nav-bar__right"><span class="van-nav-bar__text">按钮</span></div> <div class="van-nav-bar__right"><span class="van-nav-bar__text">按钮</span></div>
</div> </div>
</div> </div>
<div> <div>
<div class="van-nav-bar van-hairline--bottom" style="z-index:1;"> <div class="van-nav-bar van-hairline--bottom" style="z-index:1;">
<div class="van-nav-bar__left"> <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 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-ellipsis van-nav-bar__title">标题</div>
<div class="van-nav-bar__right"> <div class="van-nav-bar__right"><i class="van-icon van-icon-search" style="color:undefined;font-size:undefined;">
<i class="van-icon van-icon-search" style="color:undefined;font-size:undefined;">
<!----> <!---->
<!----> <!----></i></div>
</i>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

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

View File

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

View File

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

View File

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

View File

@ -2,52 +2,22 @@
exports[`renders demo correctly 1`] = ` exports[`renders demo correctly 1`] = `
<div> <div>
<div> <div><button class="van-button van-button--default van-button--normal"><span class="van-button__text">
<button class="van-button van-button--default van-button--normal"><span class="van-button__text">
弹出默认键盘 弹出默认键盘
</span></button> </span></button>
<div name="van-slide-up" class="van-number-keyboard van-number-keyboard--default" style="z-index:100;"> <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-hairline--top van-number-keyboard__title"><span></span> <span class="van-number-keyboard__close">完成</span></div>
<div class="van-number-keyboard__body"> <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>
<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> </div>
<div> <div><button class="van-button van-button--default van-button--normal"><span class="van-button__text">
<button class="van-button van-button--default van-button--normal"><span class="van-button__text">
弹出自定义键盘 弹出自定义键盘
</span></button> </span></button>
<div name="van-slide-up" class="van-number-keyboard van-number-keyboard--custom" style="z-index:100;display:none;"> <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"> <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>
<i class="van-hairline van-key">1</i> <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>
<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> </div>
</div> </div>

View File

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

View File

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

View File

@ -32,12 +32,9 @@ exports[`renders demo correctly 1`] = `
<div>内容</div> <div>内容</div>
</div> </div>
<div class="van-hairline--top van-panel__footer"> <div class="van-hairline--top van-panel__footer">
<div> <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">
<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> </span></button></div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -5,43 +5,18 @@ exports[`renders demo correctly 1`] = `
<div> <div>
<div class="van-password-input"> <div class="van-password-input">
<ul class="van-hairline--surround van-password-input__security"> <ul class="van-hairline--surround van-password-input__security">
<li class="van-hairline"> <li class="van-hairline"><i style="visibility:visible;"></i></li>
<i style="visibility:visible;"></i> <li class="van-hairline"><i style="visibility:visible;"></i></li>
</li> <li class="van-hairline"><i style="visibility:visible;"></i></li>
<li class="van-hairline"> <li class="van-hairline"><i style="visibility:hidden;"></i></li>
<i style="visibility:visible;"></i> <li class="van-hairline"><i style="visibility:hidden;"></i></li>
</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:hidden;"></i>
</li>
<li class="van-hairline">
<i style="visibility:hidden;"></i>
</li>
<li class="van-hairline">
<i style="visibility:hidden;"></i>
</li>
</ul> </ul>
<div class="van-password-input__info">密码为 6 位数字</div> <div class="van-password-input__info">密码为 6 位数字</div>
</div> </div>
<div name="van-slide-up" class="van-number-keyboard van-number-keyboard--default" style="z-index:100;"> <div name="van-slide-up" class="van-number-keyboard van-number-keyboard--default" style="z-index:100;">
<!----> <!---->
<div class="van-number-keyboard__body"> <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>
<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> </div>

View File

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

View File

@ -2,7 +2,7 @@
exports[`column watch default index 1`] = ` exports[`column watch default index 1`] = `
<div class="van-picker-column" style="height: 0px;"> <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--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 van-picker-column__item--selected" style="height: 50px;">1990</li>
<li class="van-ellipsis van-picker-column__item" style="height: 50px;">1991</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`] = ` exports[`column watch default index 2`] = `
<div class="van-picker-column" style="height: 0px;"> <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 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" style="height: 50px;">1990</li>
<li class="van-ellipsis van-picker-column__item van-picker-column__item--selected" style="height: 50px;">1991</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 PickerColumn from '../PickerColumn';
import { mount, triggerDrag, later } from '../../../test/utils'; import { mount, triggerDrag, later } from '../../../test/utils';
@ -101,7 +101,7 @@ test('drag simple columns', () => {
expect(wrapper.emitted('change')[0][1]).toEqual('1992'); 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 disabled = { disabled: true, text: 1 };
const wrapper = mount(PickerColumn, { const wrapper = mount(PickerColumn, {
propsData: { propsData: {

View File

@ -2,16 +2,12 @@
exports[`renders demo correctly 1`] = ` exports[`renders demo correctly 1`] = `
<div> <div>
<div> <div><button class="van-button van-button--default van-button--normal"><span class="van-button__text">弹出 Popup</span></button>
<button class="van-button van-button--default van-button--normal"><span class="van-button__text">弹出 Popup</span></button>
<!----> <!---->
</div> </div>
<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>
<!----> <!----> <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>
</div> </div>

View File

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

View File

@ -5,28 +5,23 @@ exports[`renders demo correctly 1`] = `
<div> <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;"> <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% 50%
</span></span> </span></span></div>
</div>
</div> </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;"> <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% 50%
</span></span> </span></span></div>
</div>
</div> </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;"> <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> </span></span></div>
</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;"> <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> </span></span></div>
</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;"> <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> </span></span></div>
</div>
</div> </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`] = ` 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);"> <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 test
</span></span> </span></span></div>
</div>
`; `;

View File

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

View File

@ -2,9 +2,9 @@
exports[`change head content when pulling down 1`] = ` exports[`change head content when pulling down 1`] = `
<div class="van-pull-refresh"> <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"> <div class="van-pull-refresh__head">
<!----><span class="van-pull-refresh__text">下拉即可刷新...</span> <!----> <span class="van-pull-refresh__text">下拉即可刷新...</span>
<!----> <!---->
<!----> <!---->
</div> </div>
@ -14,10 +14,10 @@ exports[`change head content when pulling down 1`] = `
exports[`change head content when pulling down 2`] = ` exports[`change head content when pulling down 2`] = `
<div class="van-pull-refresh"> <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"> <div class="van-pull-refresh__head">
<!----> <!---->
<!----><span class="van-pull-refresh__text">释放即可刷新...</span> <!----> <span class="van-pull-refresh__text">释放即可刷新...</span>
<!----> <!---->
</div> </div>
</div> </div>
@ -26,13 +26,14 @@ exports[`change head content when pulling down 2`] = `
exports[`change head content when pulling down 3`] = ` exports[`change head content when pulling down 3`] = `
<div class="van-pull-refresh"> <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__head">
<!----> <!---->
<!----> <!---->
<!----> <!---->
<div class="van-pull-refresh__loading"> <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> </div>
</div> </div>
@ -40,13 +41,14 @@ exports[`change head content when pulling down 3`] = `
exports[`change head content when pulling down 4`] = ` exports[`change head content when pulling down 4`] = `
<div class="van-pull-refresh"> <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__head">
<!----> <!---->
<!----> <!---->
<!----> <!---->
<div class="van-pull-refresh__loading"> <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> </div>
</div> </div>
@ -54,7 +56,7 @@ exports[`change head content when pulling down 4`] = `
exports[`change head content when pulling down 5`] = ` exports[`change head content when pulling down 5`] = `
<div class="van-pull-refresh"> <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"> <div class="van-pull-refresh__head">
<!----> <!---->
<!----> <!---->
@ -66,7 +68,7 @@ exports[`change head content when pulling down 5`] = `
exports[`not in page top 1`] = ` exports[`not in page top 1`] = `
<div class="van-pull-refresh"> <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"> <div class="van-pull-refresh__head">
<!----> <!---->
<!----> <!---->

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,7 +7,7 @@
:class="b('img-wrap')" :class="b('img-wrap')"
@click="previewImage" @click="previewImage"
> >
<img :src="goodsImg" > <img :src="goodsImg">
</div> </div>
<div :class="b('goods-info')"> <div :class="b('goods-info')">
<div class="van-sku__goods-name van-ellipsis">{{ goods.title }}</div> <div class="van-sku__goods-name van-ellipsis">{{ goods.title }}</div>
@ -49,7 +49,7 @@ export default create({
if (!id) return; if (!id) return;
// skuImgskuTrees1sku // 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) { if (!treeItem.v) {
return; return;

View File

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

View File

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

View File

@ -4,27 +4,21 @@ exports[`renders demo correctly 1`] = `
<div> <div>
<div> <div>
<div class="sku-container"> <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> </span></button></div>
</div>
</div> </div>
<div> <div>
<div class="sku-container"> <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> </span></button></div>
</div>
</div> </div>
<div> <div>
<div class="sku-container"> <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> </span></button></div>
</div>
</div> </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 = {}; const normalizedTree = {};
skuTree.forEach(treeItem => { skuTree.forEach(treeItem => {
normalizedTree[treeItem.k_s] = treeItem.v; normalizedTree[treeItem.k_s] = treeItem.v;
@ -45,17 +45,19 @@ export const normalizeSkuTree = (skuTree) => {
// 判断是否所有的sku都已经选中 // 判断是否所有的sku都已经选中
export const isAllSelected = (skuTree, selectedSku) => { export const isAllSelected = (skuTree, selectedSku) => {
// 筛选selectedSku对象中key值不为空的值 // 筛选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; return skuTree.length === selected.length;
}; };
// 根据已选择的sku获取skuComb // 根据已选择的 sku 获取 skuComb
export const getSkuComb = (skuList, selectedSku) => { export const getSkuComb = (skuList, selectedSku) => {
const skuComb = skuList.filter(skuComb => { const skuComb = skuList.filter(item => (
return Object.keys(selectedSku).every(skuKeyStr => { Object.keys(selectedSku).every(
return String(skuComb[skuKeyStr]) === String(selectedSku[skuKeyStr]); // eslint-disable-line skuKeyStr => String(item[skuKeyStr]) === String(selectedSku[skuKeyStr])
}); )
}); ));
return skuComb[0]; return skuComb[0];
}; };
@ -67,7 +69,7 @@ export const getSelectedSkuValues = (skuTree, selectedSku) => {
const skuValueId = selectedSku[skuKeyStr]; const skuValueId = selectedSku[skuKeyStr];
if (skuValueId !== UNSELECTED_SKU_VALUE_ID) { 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); skuValue && selectedValues.push(skuValue);
} }
return selectedValues; return selectedValues;
@ -77,19 +79,27 @@ export const getSelectedSkuValues = (skuTree, selectedSku) => {
// 判断sku是否可选 // 判断sku是否可选
export const isSkuChoosable = (skuList, selectedSku, skuToChoose) => { export const isSkuChoosable = (skuList, selectedSku, skuToChoose) => {
const { key, valueId } = skuToChoose; const { key, valueId } = skuToChoose;
// 先假设sku已选中拼入已选中sku对象中 // 先假设sku已选中拼入已选中sku对象中
const matchedSku = Object.assign({}, selectedSku, { const matchedSku = Object.assign({}, selectedSku, {
[key]: valueId [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; return stock > 0;
}; };

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