xm-select/docs/mds/XM06.md
2019-09-25 17:55:14 +08:00

1.1 KiB

下拉方向

自动auto

:::demo

<div style="height: 500px">占位div, 演示效果使用, 底部空间不足时会自动向上展开</div>

<div id="demo1" class="xm-select-demo"></div>

<script>
var demo1 = xmSelect.render({
    el: '#demo1', 
    direction: 'auto',
    data: [
        {name: '水果', value: 1},
        {name: '蔬菜', value: 2},
        {name: '桌子', value: 3},
        {name: '北京', value: 4},
    ]
})
</script>

:::

打卡向上up

:::demo

<div id="demo2" class="xm-select-demo"></div>

<script>
var demo2 = xmSelect.render({
    el: '#demo2', 
    direction: 'up',
    data: [
        {name: '水果', value: 1},
        {name: '蔬菜', value: 2},
        {name: '桌子', value: 3},
        {name: '北京', value: 4},
    ]
})
</script>

:::

打开向下down

:::demo

<div id="demo3" class="xm-select-demo"></div>

<script>
var demo3 = xmSelect.render({
    el: '#demo3', 
    direction: 'down',
    data: [
        {name: '水果', value: 1},
        {name: '蔬菜', value: 2},
        {name: '桌子', value: 3},
        {name: '北京', value: 4},
    ]
})
</script>

:::