zoukankan      html  css  js  c++  java
  • vue根据后台接口判断有数据禁止编辑

    一,

       html

    <table id="table" class="table_binding" cellpadding="0" cellspacing="0">
                <tbody>
                    <tr>
                        <th class="borderright borderbottom">标准编号</th>
                        <th class="borderright borderbottom">ID</th>
                        <th class="borderright borderbottom">标准名称</th>
                        <th class="borderright borderbottom">关联项</th>
                        <th class="borderright borderbottom">数据状态</th>
                        <th class="borderright borderbottom">操作</th>
                    </tr>
                    <tr v-for="(count,index) in coutData.data" :key="index" :item="count">
                        <td class="borderright borderbottom">{{count.standard_number}}</td>
                        <td class="borderright borderbottom">{{count.standard_id}}</td>
                        <td class="borderright borderbottom">{{count.standard_name}}</td>
                        <td class="borderright borderbottom">
                            <span v-for="(item,index) in count.item_list">{{item.item_name}}&nbsp;&nbsp;</span>
                        </td>
                        <td class="borderright borderbottom">{{count.standard_status==1?"正常":"锁定"}}</td>
                        <td class="borderright borderbottom">
                            <button>查看</button>
                            <button @click="showCboxID(count.standard_id,count)" :class="{statusbtn:count.item_list.length!=0}">编辑</button>
                        </td>
                    </tr>
                </tbody>
            </table>

    二,

      script

    
    
    <script>
        export default {
            name: 'count',
            data() {
                return {
                    thisId: '',
                    coutData: {
                        "count": 88,
    // 定义数据
    "data": [{ "standard_number": "cs044", "standard_id": "12", "standard_name": "cs022", "standard_status": '1', "item_list": [{ "item_name": "123" }, { "item_name": "13" }, { "item_name": "1" }] }, { "standard_number": "cs044", "standard_id": "44", "standard_name": "cs022", "standard_status": '2', "item_list": [] }, { "standard_number": "cs044", "standard_id": "37", "standard_name": "cs022", "standard_status": '1', "item_list": [] } ] } } }, components: { }, mounted() { console.log(this.coutData) this.getData(); }, methods: { getData() { // console.log(this.coutData) this.coutData.count = Number(this.coutData.count); this.coutData.data.forEach((item, index) => { this.coutDataa = item.item_list; }) }, showCboxID(id, count) { console.log(count); // 允许点击的时候判断访问接口 if(count.item_list.length == 0) { } } } } </script>
    
    

    三,css

        

    <style scoped lang="scss">
        @import '../../assets/css/index.scss';
        #table {
            margin:100px auto;
            tr {
                line-height:30px;
                
                td.borderright.borderbottom {
                    padding:10px 13px;
                    button {
                        background: #FFFFFF;
                    }
                    button.statusbtn {
                        color: #CCCCCC;
                        cursor: not-allowed
                    }
                }
            }
        }
    </style>
    
    
  • 相关阅读:
    ubuntu下crontab启动,重启,关闭命令
    解决ubuntu16.04下boot空间不足的方法
    Go语言变量作用域
    Go语言函数
    xftp取消自动更新
    nginx下http如何转https访问
    mysql 5.7.22 zip安装
    微服务本机搭建
    微服务集成mybatis问题
    eclipse导入本地maven项目时,有的项目的结构是文件夹的机构
  • 原文地址:https://www.cnblogs.com/liujiajiablog/p/9768175.html
Copyright © 2011-2022 走看看