Skip to content

Commit

Permalink
examples(picker): demo (#419)
Browse files Browse the repository at this point in the history
* fix(ActivityIndicator): fix wrong roller-success background-color

* feat(ruler): add new component Ruler

* feat(ruler): update for ruler

* feat(ruler): finish ruler

* code-style(activity-indicator): change color

* feat(ruler): remove mouse event and add throttle

* test(jest): add jest-canvas-mock

* feat(ruler): add new props: stepTextPosition, stepTextRender

* example(picker): fix picker demo, should use v-key

fix #416

* fix(picker): fix picker with defaultIndex

* example(picker): remove picker v-key
  • Loading branch information
supergaojian authored and xxyan0205 committed Apr 22, 2019
1 parent 762e73c commit 90ba25e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions components/picker/cascade.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function getDefaultIndex(data, defaultIndex, defaultValue) {
/**
* cascade column by set value of following columns
* @param {*} picker instance of picker-column
* @param {*} options { currentLevel, maxLevel, values }
* @param {*} fn
* @param {*} options { currentLevel, maxLevel, values }
* @param {*} fn
*/
export default function(picker, options = {}, fn) {
options = extend(defaultOptions, options)
Expand All @@ -44,7 +44,8 @@ export default function(picker, options = {}, fn) {
for (let i = options.currentLevel + 1; i < options.maxLevel; i++) {
const columnValues = (!i ? values[i] : values.children) || []
picker.setColumnValues(i, columnValues)
const activeIndex = getDefaultIndex(columnValues, options.defaultIndex[i], options.defaultValue[i])
let activeIndex = getDefaultIndex(columnValues, options.defaultIndex[i], options.defaultValue[i])
activeIndex >= columnValues.length && (activeIndex = 0)
values = columnValues[activeIndex] || []
}

Expand Down
2 changes: 1 addition & 1 deletion components/picker/demo/cases/demo0.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ export default {
},
},
}
</script>
</script>
Expand Down
2 changes: 1 addition & 1 deletion components/picker/demo/cases/demo1.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ export default {
},
},
}
</script>
</script>
Expand Down

0 comments on commit 90ba25e

Please sign in to comment.