JSFiddle - React, Tailwind, and code Playground
by smallMing
HTML
<link rel="stylesheet" href="https://unpkg.com/mint-ui/lib/style.css">
<script src="https://unpkg.com/vue"></script>
<script src="https://unpkg.com/mint-ui/lib/index.js"></script>
<div id="wrapper">
<div>选中的结果:{{value}}</div>
<div>之前的结果:{{beforeValue}}</div>
<mt-popup v-model="showAdsPicker" position="bottom">
<mt-picker :slots="slots" @change="change"></mt-picker>
</mt-popup>
</div>
CSS
.mint-popup {
width: 100% !important
}
JavaScript
new Vue({
el: '#wrapper',
data() {
return {
showAdsPicker: true,
value: null,
beforeValue: null,
slots: [
{
flex: 1,
values: ['1', '2', '3'],
textAlign: 'center'
}
]
}
},
methods: {
change(picker, values) {
this.beforeValue = JSON.stringify(this.value)
setTimeout(() => {
this.value = values
}, 1000)
}
}
})