账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    搜索无结果时,怎么把“暂无数据“显示出来?
    1151
    0

    <template>

    <div class="manage tc">
        <button class="btn-add" @click="add">新增</button>
        <div class="input-area" v-show="showAdd">
            <input type="text" placeholder="请输入管理人员姓名" v-model="nameValue" />
            <button class="btn-confirm" @click="addName">确定</button>
        </div>
        <div class="input-area">
            <input type="text" placeholder="请输入搜索内容" v-model="search" />
            <!--<button class="btn-search" @click="search">搜索</button>-->
        </div>
        <table>
            <thead>
                <tr>
                    <th>姓名</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody v-if="peoples.length">
                <tr v-for="(item,index) in searchName(peoples)">
                    <td>{{item.name}}</td>
                    <td :id="index">
                        <span @click="edit">编辑</span>
                        <span @click="del">删除</span>
                    </td>
                </tr>
            </tbody>
            <tbody v-else>
                <tr>
                    <td>No data available in table</td>
                </tr>
            </tbody>
        </table>
    
        <div class="model" v-show="showModel">
            <div class="model-content">
                <input type="text" placeholder="请输入新姓名" v-model="newName" />
                <button class="btn-concel" @click="concel">取消</button>
                <button class="btn-confirm-new" @click="changeName">确定</button>
            </div>
        </div>
        <footer-nav :class="{'isManage':isNowPage}"></footer-nav>
    </div>

    </template>

    <script>

    import FooterNav from '../../components/footer.vue';
    export default {
        components: {
            FooterNav
        },
        data() {
            return {
                isNowPage: true,
                showAdd: false,
                showModel: false,
                peoples: [],
                nameValue: '',
                newName: '',
                search: '',
                noResult: false,
                editId: 0
            }
        },
        methods: {
            add() {
                this.showAdd = true
            },
            addName() {
                var v = this.nameValue;
                if(v.trim() == "") {
                    alert('请输入管理人员姓名')
                } else {
                    var data = {};
                    data.name = v;
                    this.peoples.push(data);
                    this.nameValue = "";
                }
            },
            del(e) {
                var id = e.target.offsetParent.id;
                this.peoples.splice(id, 1)
            },
            edit(e) {
                var id = e.target.offsetParent.id;
                this.showModel = true;
                this.editId = id;
                this.newName = this.peoples[id].name;
            },
            concel() {
                this.showModel = false;
            },
            changeName() {
                var v = this.newName;
                if(v.trim() == "") {
                    alert('请输入新姓名')
                } else {
                    this.peoples[this.editId].name = this.newName;
                    this.showModel = false;
                }
            },
            searchName: function(peoples) {
                var v = this.search;
                console.log(peoples)
                if(v) {
                    return peoples.filter(function(item) {
                        return Object.keys(item).some(function(name) {
                            return String(item[name]).toLowerCase().indexOf(v) > -1;
                        })
                    });
                    //this.peoples=[];
                }
                return this.peoples;
            }
        }
    }

    </script>

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 刘小焯 普通会员 1楼

      在使用搜索引擎时,有时会出现搜索结果为“暂无数据”的情况,这可能是因为服务器暂时无法处理查询请求。这时,你可以尝试以下方法来解决这个问题:

      1. 重启搜索引擎:有时候,短暂的网络延迟可能会导致搜索结果的延迟。你可以尝试关闭并重新启动搜索引擎,看看是否能解决问题。

      2. 检查网络连接:如果可能的话,检查你的网络连接是否稳定。如果网络不稳定,搜索引擎可能会无法及时处理查询请求,从而导致搜索结果为空。

      3. 选择不同的搜索引擎:如果你经常遇到这个问题,你可能需要尝试使用不同的搜索引擎。有些搜索引擎可能更擅长处理长尾查询,因此你可能会在它们上获得更丰富的搜索结果。

      4. 联系搜索引擎客服:如果以上方法都无法解决问题,你可能需要联系搜索引擎的客服,询问是否有其他解决办法。他们可能能提供一些专业的建议或解决方案。

      总的来说,如果你经常遇到“暂无数据”的问题,建议你检查网络连接,尝试不同的搜索引擎,或者联系搜索引擎的客服。

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部