49 lines
754 B
Markdown
49 lines
754 B
Markdown
|
## 自定义样式
|
||
|
|
||
|
### 随便试试
|
||
|
|
||
|
修改一下背景色和外边距吧
|
||
|
|
||
|
:::demo
|
||
|
```html
|
||
|
<div id="demo1" class="xm-select-demo"></div>
|
||
|
|
||
|
<script>
|
||
|
var demo1 = xmSelect.render({
|
||
|
el: '#demo1',
|
||
|
style: {
|
||
|
backgroundColor: 'red',
|
||
|
marginLeft: '200px',
|
||
|
},
|
||
|
data: [
|
||
|
{name: '张三', value: 1},
|
||
|
{name: '李四', value: 2},
|
||
|
{name: '王五', value: 3},
|
||
|
]
|
||
|
})
|
||
|
</script>
|
||
|
```
|
||
|
:::
|
||
|
|
||
|
|
||
|
### 修改下拉框的最大高度
|
||
|
|
||
|
|
||
|
:::demo
|
||
|
```html
|
||
|
<div id="demo2" class="xm-select-demo"></div>
|
||
|
|
||
|
<script>
|
||
|
var demo2 = xmSelect.render({
|
||
|
el: '#demo2',
|
||
|
height: '50px',
|
||
|
data: [
|
||
|
{name: '张三', value: 1},
|
||
|
{name: '李四', value: 2},
|
||
|
{name: '王五', value: 3},
|
||
|
]
|
||
|
})
|
||
|
</script>
|
||
|
```
|
||
|
:::
|