elementUI angular适合做H5吗

在angular项目中用了这么久elementUI,今天来总结一下使用element-angular过程中遇到的坑

1.Radio 单选框

样式单一,不能重新设置按钮颜色,尺寸只有large, small,主要适用于web端,h5端也可用

2.Checkbox 多选框

样式不好做调整

3.Input 输入框

相对来说,使用情况比较顺畅

4.InputNumber 计数器

在h5中,样式不好做调整

5.Select 选择器

在H5页面上,点击select选择器,不选择的话,列表不会自动关闭

6.Slider 滑块

只支持整数,在h5上不支持手势滑动事件

总之,此框架很适合Web端,组件设计比较简洁,但是在H5上,真的问题较多,不适合做h5。

仅为个人看法

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Angular 可以通过使用 WebSocket 技术来实现 H5 即时聊天功能。以下是一个简单的示例: 1. 安装 `socket.io-client` 库: ``` npm install socket.io-client ``` 2. 在 `app.module.ts` 文件中导入 `SocketIoModule`: ```typescript import { SocketIoModule, SocketIoConfig } from 'ngx-socket-io'; const config: SocketIoConfig = { url: 'http://localhost:3000', options: {} }; @NgModule({ imports: [SocketIoModule.forRoot(config)], ... }) export class AppModule { } ``` 3. 在组件中导入 `Socket`: ```typescript import { Component } from '@angular/core'; import { Socket } from 'ngx-socket-io'; @Component({ selector: 'app-chat', template: ` <input [(ngModel)]="message" (keyup.enter)="sendMessage()"> <button (click)="sendMessage()">Send</button> <ul> <li *ngFor="let msg of messages">{{msg}}</li> </ul> ` }) export class ChatComponent { message = ''; messages: string[] = []; constructor(private socket: Socket) { socket.on('message', (msg: string) => { this.messages.push(msg); }); } sendMessage() { this.socket.emit('message', this.message); this.message = ''; } } ``` 4. 在服务器端创建 `socket.io` 实例: ```javascript const http = require('http'); const socketio = require('socket.io'); const server = http.createServer((req, res) => { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('Hello World\n'); }); const io = socketio(server); io.on('connection', (socket) => { console.log('a user connected'); socket.on('message', (msg) => { console.log('message: ' + msg); io.emit('message', msg); }); socket.on('disconnect', () => { console.log('user disconnected'); }); }); server.listen(3000, () => { console.log('listening on *:3000'); }); ``` 以上代码示例只是一个简单的实现,实际项目中需要考虑更多的安全和性能问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值