|
@@ -1,4 +1,4 @@
|
|
|
-import { PropType, computed, defineComponent, ref, toRefs } from 'vue'
|
|
|
+import { PropType, computed, defineComponent, ref, toRefs, onMounted } from 'vue'
|
|
|
import { Picker, Button, Icon } from 'vant'
|
|
|
import styles from './index.module.less'
|
|
|
|
|
@@ -21,16 +21,27 @@ export default defineComponent({
|
|
|
const columns = computed(() => {
|
|
|
return partListNames.value
|
|
|
})
|
|
|
- console.log(partListNames.value, partIndex.value, selectIndex.value, columns.value, 999999)
|
|
|
+ // console.log(partListNames.value, partIndex.value, selectIndex.value, columns.value, 999999)
|
|
|
+ /**
|
|
|
+ * 默认选中的
|
|
|
+ * picker组件,3.x的版本可以使用defaultIndex,4.x的版本只能使用v-model传递
|
|
|
+ * */
|
|
|
+ const selValues = ref([partIndex.value]);
|
|
|
+ const myPicker = ref();
|
|
|
+ onMounted(() => {
|
|
|
+ console.log(myPicker.value)
|
|
|
+ });
|
|
|
return () => (
|
|
|
<div class={styles.container}>
|
|
|
<div class={styles.top}>
|
|
|
- <div class={styles.title}>请选择您练习的乐器</div>
|
|
|
+ <div class={styles.title}>请选择您练习的乐器2</div>
|
|
|
<Icon name="cross" size={24} onClick={() => emit('close')} />
|
|
|
</div>
|
|
|
<Picker
|
|
|
+ ref={myPicker}
|
|
|
class={styles.picker}
|
|
|
defaultIndex={props.partIndex}
|
|
|
+ v-model={selValues.value}
|
|
|
showToolbar={false}
|
|
|
columns={columns.value}
|
|
|
visibleItemCount={Math.ceil(document.body.clientHeight / 44 / 3)}
|