|
|
@@ -23,6 +23,7 @@ app.use(Picker);
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
import { ref } from 'vue';
|
|
|
+ import Taro from '@tarojs/taro'
|
|
|
export default {
|
|
|
setup(props) {
|
|
|
const columns = ref([
|
|
|
@@ -36,7 +37,10 @@ app.use(Picker);
|
|
|
]);
|
|
|
|
|
|
const confirm = ( { selectedValue,selectedOptions })=>{
|
|
|
- console.log(selectedOptions.map((val: any) => val.text).join(','))
|
|
|
+ Taro.showToast({
|
|
|
+ title:selectedOptions.map((val: any) => val.text).join(','),
|
|
|
+ icon:'none'
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
return {columns, confirm};
|
|
|
@@ -113,6 +117,7 @@ Picker 通常作为用于辅助表单填写,可以搭配 Popup 实现效果。
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
import { ref } from 'vue';
|
|
|
+ import Taro from '@tarojs/taro'
|
|
|
export default {
|
|
|
setup(props) {
|
|
|
const selectedValue = ref(['ZheJiang']);
|
|
|
@@ -127,7 +132,10 @@ Picker 通常作为用于辅助表单填写,可以搭配 Popup 实现效果。
|
|
|
]);
|
|
|
|
|
|
const confirm = ( { selectedValue,selectedOptions })=>{
|
|
|
- console.log(selectedOptions.map((val: any) => val.text).join(','))
|
|
|
+ Taro.showToast({
|
|
|
+ title:selectedOptions.map((val: any) => val.text).join(','),
|
|
|
+ icon:'none'
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
return {columns,selectedValue, confirm};
|
|
|
@@ -155,6 +163,7 @@ Picker 通常作为用于辅助表单填写,可以搭配 Popup 实现效果。
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
import { ref } from 'vue';
|
|
|
+ import Taro from '@tarojs/taro'
|
|
|
export default {
|
|
|
setup(props) {
|
|
|
const selectedValue = ref(['ZheJiang']);
|
|
|
@@ -169,7 +178,10 @@ Picker 通常作为用于辅助表单填写,可以搭配 Popup 实现效果。
|
|
|
]);
|
|
|
|
|
|
const confirm = ( { selectedValue,selectedOptions })=>{
|
|
|
- console.log(selectedOptions.map((val: any) => val.text).join(','))
|
|
|
+ Taro.showToast({
|
|
|
+ title:selectedOptions.map((val: any) => val.text).join(','),
|
|
|
+ icon:'none'
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
return { columns,selectedValue, confirm};
|
|
|
@@ -197,6 +209,7 @@ Picker 通常作为用于辅助表单填写,可以搭配 Popup 实现效果。
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
import { ref } from 'vue';
|
|
|
+ import Taro from '@tarojs/taro'
|
|
|
export default {
|
|
|
setup(props) {
|
|
|
const selectedTime = ref(['Wednesday','Afternoon']);
|
|
|
@@ -218,10 +231,14 @@ Picker 通常作为用于辅助表单填写,可以搭配 Popup 实现效果。
|
|
|
]);
|
|
|
|
|
|
const confirm = ( { selectedValue,selectedOptions })=>{
|
|
|
- console.log(selectedOptions.map((val: any) => val.text).join(','))
|
|
|
+ Taro.showToast({
|
|
|
+ title:selectedOptions.map((val: any) => val.text).join(','),
|
|
|
+ icon:'none'
|
|
|
+ });
|
|
|
}
|
|
|
const change = ({ selectedValue,selectedOptions }) => {
|
|
|
console.log(selectedValue);
|
|
|
+
|
|
|
};
|
|
|
|
|
|
return {multipleColumns,change, confirm, selectedTime};
|
|
|
@@ -247,6 +264,7 @@ Picker 通常作为用于辅助表单填写,可以搭配 Popup 实现效果。
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
import { ref } from 'vue';
|
|
|
+ import Taro from '@tarojs/taro'
|
|
|
export default {
|
|
|
setup(props) {
|
|
|
const selectedCascader = ref(['FuJian', 'FuZhou','TaiJiang']);
|
|
|
@@ -298,7 +316,10 @@ Picker 通常作为用于辅助表单填写,可以搭配 Popup 实现效果。
|
|
|
]);
|
|
|
|
|
|
const confirm = ( { selectedValue,selectedOptions })=>{
|
|
|
- console.log(selectedOptions.map((val: any) => val.text).join(','))
|
|
|
+ Taro.showToast({
|
|
|
+ title:selectedOptions.map((val: any) => val.text).join(','),
|
|
|
+ icon:'none'
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -325,6 +346,7 @@ Picker 通常作为用于辅助表单填写,可以搭配 Popup 实现效果。
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
import { ref, onMounted } from 'vue';
|
|
|
+ import Taro from '@tarojs/taro'
|
|
|
export default {
|
|
|
setup(props) {
|
|
|
const asyncColumns = ref([]);
|
|
|
@@ -347,7 +369,10 @@ Picker 通常作为用于辅助表单填写,可以搭配 Popup 实现效果。
|
|
|
});
|
|
|
|
|
|
const confirm = ( { selectedValue,selectedOptions })=>{
|
|
|
- console.log(selectedOptions.map((val: any) => val.text).join(','))
|
|
|
+ Taro.showToast({
|
|
|
+ title:selectedOptions.map((val: any) => val.text).join(','),
|
|
|
+ icon:'none'
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
return {asyncColumns,asyncValue, confirm};
|
|
|
@@ -365,7 +390,7 @@ Picker 通常作为用于辅助表单填写,可以搭配 Popup 实现效果。
|
|
|
| 参数 | 说明 | 类型 | 默认值 |
|
|
|
|--------------|----------------------------------|--------|------------------|
|
|
|
| v-model:value | 默认选中项 | Array | `[]` |
|
|
|
-| columns | 对象数组,配置每一列显示的数据 | Array | - |
|
|
|
+| columns | 对象数组,配置每一列显示的数据 | PickerOption[] \| PickerOption[][] | - |
|
|
|
| title | 设置标题 | string | - |
|
|
|
| cancel-text | 取消按钮文案 | string | `取消` |
|
|
|
| ok-text | 确定按钮文案 | string | `确定` |
|
|
|
@@ -375,14 +400,7 @@ Picker 通常作为用于辅助表单填写,可以搭配 Popup 实现效果。
|
|
|
| option-height | 选项高度 | number \| string | `36` |
|
|
|
| show-toolbar | 是否显示顶部导航 | boolean | `true` |
|
|
|
|
|
|
-### Columns 数据结构
|
|
|
|
|
|
-| 键名 | 说明 | 类型 | 默认值 |
|
|
|
-|--------------|----------------------------------|--------|------------------|
|
|
|
-| text | 选项的文字内容 | string \| number | - |
|
|
|
-| value | 选项对应的值,且唯一 | string \| number | - |
|
|
|
-| children | 用于级联选项 | Array | - |
|
|
|
-| className | 添加额外的类名 | string | - |
|
|
|
|
|
|
### Events
|
|
|
|
|
|
@@ -399,6 +417,15 @@ Picker 通常作为用于辅助表单填写,可以搭配 Popup 实现效果。
|
|
|
| default | 自定义滑动数据底部区域 |
|
|
|
| top | 自定义滑动数据顶部区域 |
|
|
|
|
|
|
+### PickerOption 数据结构
|
|
|
+
|
|
|
+| 键名 | 说明 | 类型 | 默认值 |
|
|
|
+|--------------|----------------------------------|--------|------------------|
|
|
|
+| text | 选项的文字内容 | string \| number | - |
|
|
|
+| value | 选项对应的值,且唯一 | string \| number | - |
|
|
|
+| children | 用于级联选项 | Array | - |
|
|
|
+| className | 添加额外的类名 | string | - |
|
|
|
+
|
|
|
## 主题定制
|
|
|
|
|
|
### 样式变量
|