sciter.js的下载、demo和helloworld

1、下载官方SDK

Sciter.JS SDK官方地址Sciter.JS SDK on GitLab
下载后解压

2、运行demo

打开根目录的run-calculator-sciter.bat脚本
在这里插入图片描述

3、新建项目

文档:Sciter的HTML组件


  1. 创建文件夹hisc
  2. 将文件.\sciter-js-sdk-main\bin\windows\x32\scapp.exe复制到hisc文件夹
  3. 下载hello图标,png格式即可,重命名为icon.png,放入hisc文件夹
  4. hisc文件夹中新建index.htmlindex.csshello.js三个文件
    index.html
    <html window-icon="icon.png">
    <head>
        <meta charset="UTF-8">
        <title>标题</title>
        <style src="index.css" />
    </head>
    <body>
        <hello message="Hello World" />
    </body>
    </html>
    
    index.css
    hello {
        /* sciter可以读取prototype */
        prototype: Hello url(hello.js);
        display: block;
    }
    hello:expanded>h1 {
        font-size: 30dip;
    }
    hello:collapsed>h1 {
        font-size: 10dip;
    }
    button {
        width: 20px;
    }
    
    hello.js
    export class Hello extends Element {
        componentDidMount() {
            var message = this.attributes["message"] || "?";
            // sciter
            // 只识别<button.expand>+</button>标签
            // 不识别<button.expand></button.expand>标签
            this.content([<button.expand>+</button>,
            <button.collapse>-</button>,
            <h1>{message}</h1>]);
        }
        ["on click at button.expand"]() {   // note: ES2020 syntax
            this.state.expanded = true;       // 'this' is the element of class Hello
        }
        ["on click at button.collapse"]() { // handles click events
            this.state.collapsed = true;      // at button.collapse child
        }
    }
    

4、运行项目

双击打开scapp.exe程序即可
请添加图片描述



请添加图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值