0
点赞
收藏
分享

微信扫一扫

vue3+router+setup如何实现页面状态保存

凌得涂 2024-01-20 阅读 12

注意!如果焦点不在text则无法生效。

整型竟然能和字符串直接相加,立天!

import QtQuick

Window {
    width: 640
    height: 480
    visible: true
    title: qsTr("2.2 属性")

    Rectangle {
        Text {
            id: thislabel
            font.pixelSize: 30
            font.family: "Consolas"
            x: 100; y:100

            //定义个变量
            property int custom_num: 0

            //定义一个函数
            function fc() {
                custom_num += 1
            }

            //text赋值
            text: "hello world " + custom_num

            //按空格键递增
            Keys.onSpacePressed: fc()

            //当文本改变,输出内容
            onTextChanged: console.log(text)

            focus: true
        }
    }
}

 

举报

相关推荐

0 条评论