<template>
<view>
<view class="change" :style="{ bottom: bottomValue + 'px' }">
<button @click="onbutton">改变样式</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
bottomValue: 15,
isBottomAtMax: false
};
},
methods: {
onbutton() {
if (this.isBottomAtMax) {
this.bottomValue = 15;
this.isBottomAtMax = false;
} else {
this.bottomValue = 285;
this.isBottomAtMax = true;
}
}
}
};
</script>
<style lang="scss">
.change {
position: fixed;
right: 30rpx;
left: 30rpx;
}
</style>