当前位置: 首页 > news >正文

17网站一起做网店潮汕依依wordpress cnzz

17网站一起做网店潮汕依依,wordpress cnzz,大连招投标网官网,免费个人网站怎么注册摘要: 官网 今天遇到一个老项目,使用的是ThorUi组件库!之前没有用过这组件库,所以记录一下不同框架是使用情况! ThorUI 是一个基于 Thorium 的 UI 框架,用于构建跨平台的桌面应用程序。如果你打算使用 Thor…

在这里插入图片描述
摘要: 官网

今天遇到一个老项目,使用的是ThorUi组件库!之前没有用过这组件库,所以记录一下不同框架是使用情况!

ThorUI 是一个基于 Thorium 的 UI 框架,用于构建跨平台的桌面应用程序。如果你打算使用 ThorUI 来开发你的应用,以下是一些基本的步骤和示例代码,帮助你入门。

html使用ThorUi:

ThorUI 是一个基于 Thorium 的 UI 框架,用于构建跨平台的桌面应用程序。如果你想在 HTML 中使用 ThorUI,你需要确保你的项目已经正确配置了 Thorium 和 ThorUI。

以下是一个简单的示例,展示如何在 HTML 中使用 ThorUI 来创建一个基本的窗口。

  1. 初始化项目
    首先,创建一个新的目录并初始化一个 Node.js 项目:
mkdir my-thorui-app
cd my-thorui-app
npm init -y
  1. 安装 ThorUI
    在项目目录下安装 ThorUI:
npm install thorium-ui
  1. 创建主文件
    创建一个 main.js 文件,这是你的应用的入口点。
const { app, BrowserWindow } = require('thorium-ui');function createWindow() {// 创建浏览器窗口let win = new BrowserWindow({width: 800,height: 600,webPreferences: {nodeIntegration: true,contextIsolation: false,},});// 加载应用的 HTML 文件win.loadFile('index.html');
}// 当应用准备好时,创建窗口
app.whenReady().then(createWindow);// 当所有窗口关闭时退出应用(除了 macOS)
app.on('window-all-closed', () => {if (process.platform !== 'darwin') {app.quit();}
});app.on('activate', () => {if (BrowserWindow.getAllWindows().length === 0) {createWindow();}
});
  1. 创建 HTML 文件
    创建一个 index.html 文件,作为你的应用界面。
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>My ThorUI App</title><!-- 引入 ThorUI 样式 --><link rel="stylesheet" href="node_modules/thorium-ui/dist/css/thorium-ui.min.css">
</head>
<body><div class="container"><h1>Hello, ThorUI!</h1><button id="myButton" class="btn btn-primary">Click Me</button></div><!-- 引入 ThorUI JavaScript --><script src="node_modules/thorium-ui/dist/js/thorium-ui.min.js"></script><script>// 使用 ThorUI 组件document.getElementById('myButton').addEventListener('click', function() {alert('Button clicked!');});</script>
</body>
</html>
  1. 运行应用
    在项目目录下运行以下命令启动你的应用:
npx electron main.js

vue/uniapp使用ThorUi:
ThorUI 是一个基于 Thorium 的 UI 框架,用于构建跨平台的桌面应用程序。如果你想在 Vue.js 项目中使用 ThorUI,你需要确保你的项目已经正确配置了 Thorium 和 ThorUI。

以下是一个简单的示例,展示如何在 Vue.js 项目中使用 ThorUI 来创建一个基本的窗口。

  1. 初始化项目
    首先,创建一个新的目录并初始化一个 Node.js 项目:
mkdir my-vue-thorui-app
cd my-vue-thorui-app
npm init -y
  1. 安装依赖
    安装 Vue CLI 和其他必要的依赖:
npm install -g @vue/cli
vue create my-vue-app
cd my-vue-app
npm install thorium-ui
  1. 修改 main.js
    在 src 目录下找到 main.js 文件,并进行以下修改:
import { createApp } from 'vue';
import App from './App.vue';
import { app, BrowserWindow } from 'thorium-ui';function createWindow() {// 创建浏览器窗口let win = new BrowserWindow({width: 800,height: 600,webPreferences: {nodeIntegration: true,contextIsolation: false,},});// 加载应用的 HTML 文件win.loadURL('http://localhost:8080');
}// 当应用准备好时,创建窗口
app.whenReady().then(createWindow);// 当所有窗口关闭时退出应用(除了 macOS)
app.on('window-all-closed', () => {if (process.platform !== 'darwin') {app.quit();}
});app.on('activate', () => {if (BrowserWindow.getAllWindows().length === 0) {createWindow();}
});createApp(App).mount('#app');
  1. 修改 public/index.html
    在 public 目录下找到 index.html 文件,并进行以下修改:
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>My Vue ThorUI App</title><!-- 引入 ThorUI 样式 --><link rel="stylesheet" href="node_modules/thorium-ui/dist/css/thorium-ui.min.css">
</head>
<body><div id="app"></div><!-- 引入 ThorUI JavaScript --><script src="node_modules/thorium-ui/dist/js/thorium-ui.min.js"></script>
</body>
</html>
  1. 创建 Vue 组件
    在 src/components 目录下创建一个新的组件文件 HelloWorld.vue:
<template><div class="container"><h1>Hello, ThorUI!</h1><button id="myButton" class="btn btn-primary">Click Me</button></div>
</template><script>
export default {name: 'HelloWorld',mounted() {document.getElementById('myButton').addEventListener('click', function() {alert('Button clicked!');});}
};
</script><style scoped>
.container {text-align: center;margin-top: 50px;
}
</style>
  1. 修改 App.vue
    在 src 目录下找到 App.vue 文件,并进行以下修改:
<template><div id="app"><HelloWorld /></div>
</template><script>
import HelloWorld from './components/HelloWorld.vue';export default {name: 'App',components: {HelloWorld,},
};
</script>
  1. 运行应用
    在项目目录下运行以下命令启动你的应用:
npm run serve

然后,打开另一个终端窗口,运行以下命令启动 Thorium 应用:

npx electron main.js

react使用ThorUi:

ThorUI 是一个基于 Thorium 的 UI 框架,用于构建跨平台的桌面应用程序。如果你想在 React 项目中使用
ThorUI,你需要确保你的项目已经正确配置了 Thorium 和 ThorUI。

以下是一个简单的示例,展示如何在 React 项目中使用 ThorUI 来创建一个基本的窗口。

  1. 初始化项目
    首先,创建一个新的目录并初始化一个 Node.js 项目:
mkdir my-react-thorui-app
cd my-react-thorui-app
npm init -y
  1. 安装依赖
    安装 React 和其他必要的依赖:
npx create-react-app my-react-app
cd my-react-app
npm install thorium-ui
  1. 修改 public/index.html
    在 public 目录下找到 index.html 文件,并进行以下修改:
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>My React ThorUI App</title><!-- 引入 ThorUI 样式 --><link rel="stylesheet" href="node_modules/thorium-ui/dist/css/thorium-ui.min.css">
</head>
<body><div id="root"></div><!-- 引入 ThorUI JavaScript --><script src="node_modules/thorium-ui/dist/js/thorium-ui.min.js"></script>
</body>
</html>
  1. 修改 src/App.js
    在 src 目录下找到 App.js 文件,并进行以下修改:
import React, { useEffect } from 'react';
import { app, BrowserWindow } from 'thorium-ui';function App() {useEffect(() => {function createWindow() {// 创建浏览器窗口let win = new BrowserWindow({width: 800,height: 600,webPreferences: {nodeIntegration: true,contextIsolation: false,},});// 加载应用的 HTML 文件win.loadURL('http://localhost:3000');}// 当应用准备好时,创建窗口app.whenReady().then(createWindow);// 当所有窗口关闭时退出应用(除了 macOS)app.on('window-all-closed', () => {if (process.platform !== 'darwin') {app.quit();}});app.on('activate', () => {if (BrowserWindow.getAllWindows().length === 0) {createWindow();}});}, []);return (<div className="container"><h1>Hello, ThorUI!</h1><button id="myButton" className="btn btn-primary">Click Me</button></div>);
}export default App;
  1. 修改 src/index.js
    在 src 目录下找到 index.js 文件,并进行以下修改:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';ReactDOM.render(<React.StrictMode><App /></React.StrictMode>,document.getElementById('root')
);// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
  1. 运行应用
    在项目目录下运行以下命令启动你的应用:
npm start

然后,打开另一个终端窗口,运行以下命令启动 Thorium 应用:

npx electron main.js

Angular使用ThorUi:

ThorUI 是一个基于 Thorium 的 UI 框架,用于构建跨平台的桌面应用程序。如果你想在 Angular 项目中使用
ThorUI,你需要确保你的项目已经正确配置了 Thorium 和 ThorUI。

以下是一个简单的示例,展示如何在 Angular 项目中使用 ThorUI 来创建一个基本的窗口。

  1. 初始化项目
    首先,创建一个新的目录并初始化一个 Node.js 项目:
mkdir my-angular-thorui-app
cd my-angular-thorui-app
npm init -y
  1. 安装依赖
    安装 Angular CLI 和其他必要的依赖:
npm install -g @angular/cli
ng new my-angular-app
cd my-angular-app
npm install thorium-ui
  1. 修改 src/index.html
    在 src 目录下找到 index.html 文件,并进行以下修改:
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>My Angular ThorUI App</title><!-- 引入 ThorUI 样式 --><link rel="stylesheet" href="node_modules/thorium-ui/dist/css/thorium-ui.min.css">
</head>
<body><app-root></app-root><!-- 引入 ThorUI JavaScript --><script src="node_modules/thorium-ui/dist/js/thorium-ui.min.js"></script>
</body>
</html>
  1. 修改 src/app/app.component.ts
    在 src/app 目录下找到 app.component.ts 文件,并进行以下修改:
import { Component, OnInit } from '@angular/core';
import { app, BrowserWindow } from 'thorium-ui';@Component({selector: 'app-root',templateUrl: './app.component.html',styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {title = 'My Angular ThorUI App';ngOnInit() {function createWindow() {// 创建浏览器窗口let win = new BrowserWindow({width: 800,height: 600,webPreferences: {nodeIntegration: true,contextIsolation: false,},});// 加载应用的 HTML 文件win.loadURL('http://localhost:4200');}// 当应用准备好时,创建窗口app.whenReady().then(createWindow);// 当所有窗口关闭时退出应用(除了 macOS)app.on('window-all-closed', () => {if (process.platform !== 'darwin') {app.quit();}});app.on('activate', () => {if (BrowserWindow.getAllWindows().length === 0) {createWindow();}});}
}
  1. 修改 src/app/app.component.html
    在 src/app 目录下找到 app.component.html 文件,并进行以下修改:
<div class="container"><h1>{{ title }}</h1><button id="myButton" class="btn btn-primary">Click Me</button>
</div>
  1. 运行应用
    在项目目录下运行以下命令启动你的应用:
ng serve

然后,打开另一个终端窗口,运行以下命令启动 Thorium 应用:

npx electron main.js
http://www.yayakq.cn/news/532663/

相关文章:

  • 谁做的四虎网站是多少钱租一个网站服务器多少钱
  • 网站群建设 实现了雕刻业务网站怎么做
  • 网站设计的目的和任务wordpress查询数据库结构
  • 泌阳县住房建设局网站石家庄模板做网站
  • 江苏常州网站建设公司图文排版设计
  • 织梦网站怎么重新安装无锡手机网站建设服务
  • 网站的建设与维护实践报告网站开发的研究现状
  • 美的网站建设设计购物网站
  • 昆明城乡建设局网站北京开发网站建设
  • 个人备案20字备注短视频搜索优化
  • 做软件推广网站怎么赚钱2021国内最好用免费建站系统
  • 青岛地产网站建设吉安建设局官方网站
  • 企业网站建设方案教程西安到北京西火车时刻表
  • 网站建设管理工作小结网站在哪里变更备案信息
  • 站酷网在线官网网络公关公司收费
  • 免费关键词排名优化广州企业搜索引擎优化服务
  • 让别人做网站需要提供什么南宁市公共资源交易中心网
  • 宝安响应式网站建设推荐黄石网站建设
  • 机械产品做那几个网站好台州seo外链推广代理
  • 学风网站建设正规的镇江网站建设
  • 西安市网站建设WordPress和微信同步
  • php与dw怎么做校园网站江门seo网络推广
  • 静态展示网站模板下载做网站一个月赚多少
  • 青海省高等级公路建设管局网站15年做哪些网站能致富
  • 对新网站做seo大概需要多久精仿源码社区网站源码
  • 招生网站开发的背景高青县住房和城乡建设局网站
  • 企业网站图片上传新项目首码对接平台
  • 做网站要买服务器吗市场营销考试题目及答案2022
  • 怎么做网站弹幕免费网站安全
  • 网站建设丶金手指下拉14电商网站平台建设方案