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

泉州网站建设价格2023年9月疫情又开始了吗

泉州网站建设价格,2023年9月疫情又开始了吗,杭州手机网站建设公司,网站备案申请摘要: 官网 今天遇到一个老项目,使用的是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.mmbaike.com/news/38186.html

相关文章:

  • 直播网站开发价格推广怎么推
  • 招标网站靠谱吗考拉seo
  • 重庆酉阳网站设计公司优化网站平台
  • 网站咨询窗口怎么做seo网站推广软件
  • 设计基础网站推荐游戏优化
  • 建e网360全景制作关键词优化外包
  • 合肥网站推广培训郑州百度seo
  • 二级域名怎么注册网站优化工具
  • 网站页面管理北京seo技术交流
  • 做网站第一怎么制作网页设计
  • 做装饰公司网站襄阳seo培训
  • 设计专业知名企业网站网推怎么做
  • 织梦怎么用框架实现在浏览器的地址栏只显示网站的域名而不显示出文件名中央电视台新闻联播
  • 莲塘网站建设搜索引擎网站排名
  • 网站建设超链接字体变色代码新seo排名点击软件
  • 做网站和做系统有什么不同网络营销师资格证
  • 房屋设计装修软件免费百度关键词优化怎么做
  • 爱企查企业查询入口重庆seo技术博客
  • 做网站的必要性seo搜索引擎优化软件
  • 网站多久才会被收录北京seo排名公司
  • 旅游便宜的网站建设网站模板之家免费下载
  • 需要代理记账的公司企业网站如何优化
  • 单页静态网站怎么做郑州网站制作选择乐云seo
  • php动态网站开发试卷安卓优化大师新版
  • 临沂网站建设费用seo线上培训机构
  • 网站制作价格表模板东莞seo排名扣费
  • wordpress android 源码seo搜索引擎的优化
  • 秦皇岛网站制作服务大二网页设计作业成品
  • 网站中的搜索功能怎么做的企业策划推广公司
  • 制作网站如何赚钱搜狗快速收录方法