Skip to content

Commit

Permalink
refactor: 重构选择器联动逻辑,适配vant的areaList数据结构 (#5)
Browse files Browse the repository at this point in the history
* refactor(src): 重构成使用扁平结构的地址查询表,数据结构和编码与vant 地址选择组件同步

- 修改了组件默认使用的数据结构
- 使用 memoize 缓存相同查询的结果
- 优化代码,减少使用ifelse 和 switch case
- 优化了对错误输入的兼容

BREAKING CHANGE: 如果使用默认的地址数据可以继续使用,如果引入了自定义的地址数据需要转换为新的数据结构。
  • Loading branch information
lianghx-319 authored and levy9527 committed Apr 30, 2019
1 parent 0591235 commit 9ecf4db
Show file tree
Hide file tree
Showing 37 changed files with 14,150 additions and 29,044 deletions.
7 changes: 3 additions & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{
"presets": [
["env", { "modules": false }]
["@babel/env", { "modules": false }]
],
"env": {
"test": {
"presets": [
["env", { "targets": { "node": "current" }}]
["@babel/env", { "targets": { "node": "current" }}]
]
}
},
"plugins": [
["transform-runtime", {
"polyfill": false,
["@babel/transform-runtime", {
"regenerator": true
}]
]
Expand Down
7 changes: 6 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
dist
docs/**/*[!md]

# Editor directories and files
.idea
Expand All @@ -11,3 +13,4 @@ yarn-error.log*
*.ntvs*
*.njsproj
*.sln
.env
21 changes: 21 additions & 0 deletions .grenrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
dataSource: 'prs',
prefix: '',
ignoreLabels: ['duplicate', 'help wanted', 'invalid', 'question', 'wontfix'],
ignoreIssuesWith: [
'duplicate',
'help wanted',
'invalid',
'question',
'wontfix'
],
onlyMilestones: false,
changelogFilename: 'CHANGELOG.md',
template: {
issue: '- {{name}} [{{text}}]({{url}})'
},
groupBy: {
'✨ New Features:': ['enhancement'],
'🐛 Bug Fixes:': ['bug']
}
}
16 changes: 0 additions & 16 deletions .storybook/config.js

This file was deleted.

23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
branches:
only:
- master
language: node_js
node_js:
- lts/*
git:
depth: 3
install:
- yarn --frozen-lockfile
script:
- yarn build
cache: yarn
deploy:
- provider: pages
local-dir: docs
github-token: $GITHUB_TOKEN
skip-cleanup: true
keep-history: true
- provider: npm
email: [email protected]
api_key: $NPM_TOKEN
skip-cleanup: true
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@

## Demo

* [online demo](https://femessage.github.io/el-select-area/storybook/)
* [full api doc](https://femessage.github.io/el-select-area/)
* [doc and online demo](https://femessage.github.io/el-select-area/)

[⬆ Back to Top](#table-of-contents)

Expand Down
6 changes: 4 additions & 2 deletions build/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// rollup.config.js
import vue from 'rollup-plugin-vue'
import babel from 'rollup-plugin-babel'
import uglify from 'rollup-plugin-uglify-es'
import commonjs from 'rollup-plugin-commonjs'
import {terser} from 'rollup-plugin-terser'
import minimist from 'minimist'

const argv = minimist(process.argv.slice(2))
Expand All @@ -13,6 +14,7 @@ const config = {
exports: 'named'
},
plugins: [
commonjs(),
vue({
css: true,
compileTemplate: true
Expand All @@ -26,7 +28,7 @@ const config = {

// Only minify browser (iife) version
if (argv.format === 'iife') {
config.plugins.push(uglify())
config.plugins.push(terser())
}

export default config
Loading

0 comments on commit 9ecf4db

Please sign in to comment.