// myjs.js
function func() {
print("call func");
}
function func1() {
print("call func1");
}
function title() {
return "MyTitle";
}
import QtQuick
import "myjs.js" as MyJs
import QtQuick.Controls as Con
Window {
width: 640
height: 480
visible: true
// title: qsTr("Hello World")
title: MyJs.title()
Con.Button {
x: 20
y: 20
text: qsTr("11111")
onClicked: {
MyJs.func()
MyJs.func1()
}
}
}
评论