|
|
@@ -95,7 +95,7 @@ export default {
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { reactive, ref,h, h } from 'vue';
|
|
|
+import { reactive, ref,h } from 'vue';
|
|
|
import { Location,Cart2, My2 } from '@nutui/icons-vue-taro';
|
|
|
export default {
|
|
|
setup() {
|
|
|
@@ -191,27 +191,21 @@ export default {
|
|
|
});
|
|
|
const selfContent = reactive([
|
|
|
{
|
|
|
- name: Service,
|
|
|
desc: 'option1'
|
|
|
},
|
|
|
{
|
|
|
- name: Notice,
|
|
|
desc: 'option2'
|
|
|
},
|
|
|
{
|
|
|
- name: Location,
|
|
|
desc: 'option3'
|
|
|
},
|
|
|
{
|
|
|
- name: Category,
|
|
|
desc: 'option4'
|
|
|
},
|
|
|
{
|
|
|
- name: Scan2,
|
|
|
desc: 'option5'
|
|
|
},
|
|
|
{
|
|
|
- name: Message,
|
|
|
desc: 'option6'
|
|
|
}
|
|
|
]);
|
|
|
@@ -225,7 +219,7 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
-#app{
|
|
|
+page{
|
|
|
padding-top: 200px;
|
|
|
}
|
|
|
.self-content {
|
|
|
@@ -273,34 +267,113 @@ bottom-end # 底部右侧位置
|
|
|
:::demo
|
|
|
```html
|
|
|
<template>
|
|
|
- <nut-popover v-model:visible="visible" location="top" theme="dark" :list="iconItemList">
|
|
|
- <template #reference>
|
|
|
- <div class="brick"></div>
|
|
|
- </template>
|
|
|
- </nut-popover>
|
|
|
+ <nut-cell title="点击查看更多方向" @click="handlePicker"></nut-cell>
|
|
|
+ <nut-popup position="bottom" v-model:visible="showPicker">
|
|
|
+ <nut-picker
|
|
|
+ :columns="columns"
|
|
|
+ title=""
|
|
|
+ @change="change"
|
|
|
+ :swipe-duration="500"
|
|
|
+ @confirm="closePicker"
|
|
|
+ @close="closePicker"
|
|
|
+ >
|
|
|
+ <template #top>
|
|
|
+ <div class="brickBox">
|
|
|
+ <div class="brick" id="pickerTarget"></div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </nut-picker>
|
|
|
+ </nut-popup>
|
|
|
+
|
|
|
+ <nut-popover
|
|
|
+ v-model:visible="customPositon"
|
|
|
+ targetId="pickerTarget"
|
|
|
+ :location="curPostion"
|
|
|
+ theme="dark"
|
|
|
+ :list="positionList"
|
|
|
+ >
|
|
|
+ </nut-popover>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
import { reactive, ref } from 'vue';
|
|
|
export default {
|
|
|
setup() {
|
|
|
- const visible = ref(false);
|
|
|
+ const showPicker = ref(false);
|
|
|
+ const customPositon = ref(false);
|
|
|
+ const curPostion = ref('top');
|
|
|
+ const positionList = reactive([
|
|
|
+ {
|
|
|
+ name: 'option1'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'option2'
|
|
|
+ }
|
|
|
+ ]);
|
|
|
+ const closePicker = () => {
|
|
|
+ customPositon.value = false;
|
|
|
+ showPicker.value = false;
|
|
|
+ };
|
|
|
|
|
|
- const iconItemList = reactive([
|
|
|
- {
|
|
|
- name: '选项一'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '选项二'
|
|
|
- }]);
|
|
|
+ const change = ({ selectedValue }) => {
|
|
|
+ curPostion.value = selectedValue[0];
|
|
|
+ if (showPicker.value) customPositon.value = true;
|
|
|
+ };
|
|
|
+
|
|
|
+ const handlePicker = () => {
|
|
|
+ showPicker.value= true;
|
|
|
+ setTimeout(() => {
|
|
|
+ customPositon.value = true;
|
|
|
+ }, 1000);
|
|
|
+ };
|
|
|
+
|
|
|
+ const columns = ref([
|
|
|
+ { text: 'top', value: 'top' },
|
|
|
+ { text: 'top-start', value: 'top-start' },
|
|
|
+ { text: 'top-end', value: 'top-end' },
|
|
|
+ { text: 'right', value: 'right' },
|
|
|
+ { text: 'right-start', value: 'right-start' },
|
|
|
+ { text: 'right-end', value: 'right-end' },
|
|
|
+ { text: 'bottom', value: 'bottom' },
|
|
|
+ { text: 'bottom-start', value: 'bottom-start' },
|
|
|
+ { text: 'bottom-end', value: 'bottom-end' },
|
|
|
+ { text: 'left', value: 'left' },
|
|
|
+ { text: 'left-start', value: 'left-start' },
|
|
|
+ { text: 'left-end', value: 'left-end' }
|
|
|
+ ]);
|
|
|
|
|
|
return {
|
|
|
- iconItemList,
|
|
|
- visible,
|
|
|
+ positionList,
|
|
|
+ showPicker,
|
|
|
+ customPositon,
|
|
|
+ curPostion,
|
|
|
+ closePicker,
|
|
|
+ change,
|
|
|
+ handlePicker,
|
|
|
+ columns
|
|
|
};
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+
|
|
|
+.nut-popover-content {
|
|
|
+ width: 120px;
|
|
|
+}
|
|
|
+
|
|
|
+.brickBox {
|
|
|
+ margin: 80px 0;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ .brick {
|
|
|
+ width: 60px;
|
|
|
+ height: 60px;
|
|
|
+ background: linear-gradient(135deg, #fa2c19 0%, #fa6419 100%);
|
|
|
+ border-radius: 10px;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|
|
|
```
|
|
|
:::
|
|
|
|
|
|
@@ -342,7 +415,7 @@ export default {
|
|
|
}
|
|
|
</script>
|
|
|
<style>
|
|
|
-#app{
|
|
|
+page{
|
|
|
margin-top:300px
|
|
|
}
|
|
|
.nut-popover-content {
|
|
|
@@ -389,7 +462,7 @@ export default {
|
|
|
|
|
|
</script>
|
|
|
<style>
|
|
|
-#app{
|
|
|
+page{
|
|
|
margin-top:300px
|
|
|
}
|
|
|
.nut-popover-content {
|
|
|
@@ -408,10 +481,10 @@ export default {
|
|
|
| visible | 是否展示气泡弹出层 | boolean | `false` |
|
|
|
| theme | 主题风格,可选值为 dark | string | `light` |
|
|
|
| location | 弹出位置 | string | `bottom` |
|
|
|
-| offset | 出现位置的偏移量 | [number, number] | `[0, 12]` |
|
|
|
+| offset | 出现位置的偏移量 | number \| string | `[0, 12]` |
|
|
|
| show-arrow | 是否显示小箭头 | boolean | `true` |
|
|
|
| custom-class | 自定义 class 值 | string | `''` |
|
|
|
-| duration | 动画时长,单位秒 | [number, string] | `0.3` |
|
|
|
+| duration | 动画时长,单位秒 | number \| string | `0.3` |
|
|
|
| overlay | 是否显示遮罩层 | boolean | `false` |
|
|
|
| overlay-class | 自定义遮罩层类名 | string | `''` |
|
|
|
| overlay-style | 自定义遮罩层样式 | string | `''` |
|
|
|
@@ -429,7 +502,7 @@ List 属性是一个由对象构成的数组,数组中的每个对象配置一
|
|
|
| 键名 | 说明 | 类型 | 默认值 |
|
|
|
|----------------|----------------------|----------|--------|
|
|
|
| name | 选项文字 | string | `-` |
|
|
|
-| icon | `@nutui/icons-vue-taro` 图标 | string | `-` |
|
|
|
+| icon | `@nutui/icons-vue-taro` 图标 | VNode | `-` |
|
|
|
| disabled | 是否为禁用状态 | boolean | `false` |
|
|
|
| className | 为对应选项添加额外的类名 | string \| Array \| object | `-` |
|
|
|
|