Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] input not work #5681

Closed
sweetmainW opened this issue Nov 23, 2022 · 4 comments
Closed

[bug] input not work #5681

sweetmainW opened this issue Nov 23, 2022 · 4 comments
Labels
status: needs more info Issue needs more information, discussion or reproducible example status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@sweetmainW
Copy link

Describe the bug

console: [54368:28087849] TSM AdjustCapsLockLEDForKeyTransitionHandling - _ISSetPhysicalKeyboardCapsLockLED Inhibit

The browser works normally

Tauri does not work

Reproduction

Expected behavior

No response

Platform and versions

Environment
› OS: Mac OS 12.4.0 X64
› Node.js: 16.17.0
› npm: 8.19.3
› pnpm: Not installed!
› yarn: Not installed!
› rustup: 1.25.1
› rustc: 1.62.1
› cargo: 1.62.1
› Rust toolchain: stable-x86_64-apple-darwin

Packages
› @tauri-apps/cli [NPM]: 1.1.1 (outdated, latest: 1.2.0)
› @tauri-apps/api [NPM]: Not installed!
› tauri [RUST]: 1.2.0,
› tauri-build [RUST]: 1.2.0,
› tao [RUST]: 0.15.6,
› wry [RUST]: 0.22.2,

App
› build-type: bundle
› CSP: unset
› distDir: ../dist
› devPath: http://localhost:5173/
› framework: Vue.js

App directory structure
├─ node_modules
├─ public
├─ src-tauri
├─ .git
└─ src

Stack trace

[54368:28087849] TSM AdjustCapsLockLEDForKeyTransitionHandling - _ISSetPhysicalKeyboardCapsLockLED Inhibit

Additional context

No response

@sweetmainW sweetmainW added status: needs triage This issue needs to triage, applied to new issues type: bug labels Nov 23, 2022
@amrbashir
Copy link
Member

Please give more info and a minimal repro.

@amrbashir amrbashir added the status: needs more info Issue needs more information, discussion or reproducible example label Nov 23, 2022
@sweetmainW
Copy link
Author

<script setup lang="ts">
import message from 'ant-design-vue/lib/message';
import { ref } from 'vue'
import { formatSeconds } from '../utils/TimeUtils';

defineProps<{ msg: string }>()

// 输入框内容
const value = ref<string>('');

// 要扫描的目录
const dirData = ref<ScanDir[]>([]);

// 是否开启扫描任务
const loading = ref(false);

//当前扫描的文件
const currentScanFilePath = ref("获取信息中...");

// 本次扫描是否完成
const scanFileComplete = ref(false);
// 本次共扫描多少文件
const scanFileNum = ref(0);
const resultTitle = ref("本次一共扫描:");
const resultSubTitle = ref("共耗时");
const startTime = ref(new Date());

const fileDataList = ref<FileModel[]>([]);


const columns = [
    {
        title: '文件名',
        dataIndex: 'name',
        key: 'name',
    },
    {
        title: '大小',
        dataIndex: 'age',
        key: 'age',
    },
    {
        title: '数量',
        dataIndex: 'address',
        key: 'address',
    },
    {
        title: '位置',
        key: 'tags',
        dataIndex: 'tags',
    },
    {
        title: '操作',
        key: 'action',
    },
];

const data = [
    {
        key: '1',
        name: 'John Brown',
        age: 32,
        address: 'New York No. 1 Lake Park',
        tags: ['nice', 'developer'],
    },
    {
        key: '2',
        name: 'Jim Green',
        age: 42,
        address: 'London No. 1 Lake Park',
        tags: ['loser'],
    },
    {
        key: '3',
        name: 'Joe Black',
        age: 32,
        address: 'Sidney No. 1 Lake Park',
        tags: ['cool', 'teacher'],
    },
];


const addDir = () => {
    if (loading.value) {
        message.error('正在扫描中,暂时不能添加');
        return;
    }
    console.log("value: " + value);
    if (value.value) {
        dirData.value = [...dirData.value, {
            dir: value.value
        }];
        value.value = "";
    }
}

const startScan = () => {
    if (loading.value) {
        loading.value = false;
        return;
    }
    scanFileComplete.value = false;
    loading.value = true;
    startTime.value = new Date();
    console.log("start...");
    const intervalId = setInterval(() => {
        currentScanFilePath.value = new Date().toString();
    }, 500);
    setTimeout(() => {
        clearInterval(intervalId);
        let t = new Date().getTime() - startTime.value.getTime();
        resultSubTitle.value = "共耗时 " + formatSeconds(t / 1000);
        resultTitle.value = "本次一共扫描 1000 个文件"
        loading.value = false;
        scanFileComplete.value = true;
    }, 10000);
}

const delDirItem = (delDir: ScanDir) => {
    if (loading.value) {
        message.error('正在扫描中,暂时不能删除');
        return;
    }
    dirData.value = dirData.value.filter(i => i.dir != delDir.dir);
}

const onKeypress = (event: any) => {
    if (event.key == 'Enter') {
        addDir();
    }
}

interface ScanDir {
    dir: string;
}

interface FileModel {
    md5: string;
    name: string;
    num: number;
    size: number;
    sizeStr: string;
    path: string[];
}

interface DataItem {
    key: string;
    name: string;
    age: number;
    address: string;
}

</script>

<template>
    <a-row>
        <a-col :span="3">
            <div> </div>
        </a-col>
        <a-col :span="15">
            <a-input class="inputBar0" v-model:value="value" placeholder="输入要扫描的目录" size="large"
                @keyup="onKeypress($event)" />
        </a-col>
        <a-col :span="6">
            <a-button class="addBtn" type="primary" size="large" @click="addDir" :disabled="loading">添加
            </a-button>
            <a-button class="scanBtn" type="primary" size="large" @click="startScan" :disabled="dirData.length == 0">
                {{ loading ? '停止扫描' : '开始扫描' }}
            </a-button>
        </a-col>

    </a-row>

    <a-row>
        <a-col :span="3">
        </a-col>
        <a-col :span="15">
            <a-list v-if="dirData.length > 0" class="dirList" bordered style="" item-layout="horizontal"
                :data-source="dirData">
                <template #renderItem="{ item }">
                    <a-list-item>
                        <template #actions>
                            <a key="list-item-del" @click="delDirItem(item)">删除</a>
                        </template>
                        <a-list-item-meta>
                            <template #title>
                                {{ item.dir }}
                            </template>
                        </a-list-item-meta>
                    </a-list-item>
                </template>
            </a-list>
        </a-col>
        <a-col :span="6">
        </a-col>
    </a-row>


    <a-spin v-if="loading" tip="Loading...">
        <a-alert class="dirList" message="正在扫描" :description="currentScanFilePath"></a-alert>
    </a-spin>
    <a-result v-if="scanFileComplete" status="success" :title="resultTitle" :sub-title="resultSubTitle">
    </a-result>

    <a-table class="fileList" :columns="columns" :data-source="data" bordered>
        <template #bodyCell="{ column, record }">
            <template v-if="column.key === 'name'">
                <a>
                    {{ record.name }}
                </a>
            </template>
            <template v-else-if="column.key === 'tags'">
                <span>
                    <a-tag v-for="tag in record.tags" :key="tag"
                        :color="tag === 'loser' ? 'volcano' : tag.length > 5 ? 'geekblue' : 'green'">
                        {{ tag.toUpperCase() }}
                    </a-tag>
                </span>
            </template>
            <template v-else-if="column.key === 'action'">
                <span>
                    <a>删除</a>
                    <a-divider type="vertical" />
                    <a class="ant-dropdown-link">
                        查看
                        <down-outlined />
                    </a>
                </span>
            </template>
        </template>
    </a-table>

</template>

<style scoped>
.dirList {
    margin-top: 20px;
    margin-bottom: 20px;
}

.addBtn {
    margin-left: 20px;
    margin-right: 20px;
}
</style>

@amrbashir
Copy link
Member

This should be fixed by tauri-apps/wry#764, try running cargo update inside src-tauri

@kakajansh
Copy link

It may be related to #3541 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs more info Issue needs more information, discussion or reproducible example status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

3 participants