|
参考这个代码修改一下看看
- <template>
- <view class="page">
- <view onclick="this.fnchange()" class={ this.data.hasborder ? "a1" : "a2" }>
- <text>abcd</text>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: 'new',
- apiready(){//like created
- },
- data() {
- return{
- hasborder : true
- }
- },
- methods: {
- fnchange(){
- this.data.hasborder = !this.data.hasborder;
- console.log(this.data.hasborder);
- }
- }
- }
- </script>
- <style>
- .page {
- height: 100%;
- background-color: #fff;
- padding-top: 70px;
- }
- .a1{
- border-bottom-color: #ffff00;
- border-bottom-style: solid;
- border-bottom-width: 2px
- }
- .a2{
- border-bottom-width: 0px
- }
- </style>
复制代码 |
|