使用前端开发工具包WijmoJS - 创建自定义DropDownTree控件(包含源代码)

article/2025/9/23 19:28:33

概述

最近,有客户向我们请求开发一个前端下拉控件,需求是显示了一个列表,其中包含可由用户单独选择的项目控件,该控件将在下拉列表中显示多选TreeView(树形图)。

如今WijmoJS已经实现了该控件——DropDownTree,本文将主要介绍如何创建自定义DropDownTree控件以及其源代码。

DropDownTree 控件源代码

HTML

<div class="container"><h1>DropDownTree Control</h1><p>The <b>DropDownTree</b> control is similar to a <b>MultiSelect</b>, but it hosts a <b>TreeView</b> in the drop-down instead of a <b>ListBox</b>.</p><p>The <b>DropDownTree</b>'s object model is also similar to the <b>MultiSelect</b>'s: you can listento the <b>checkedItemsChanged</b> event and get/setthe selection using the <b>checkedItems</b> property:</p><h3>Drop-Down-Tree</h3><input id="ddTree" placeholder="multi tree"><h3>Multi-Select</h3><input id="multiSelect" placeholder="multi select">
</div>

JavaScript

onload = function() {// create the DropDownTreevar ddTree = new wijmo.input.DropDownTree('#ddTree', {displayMemberPath: 'header',childItemsPath: 'items',showCheckboxes: true,itemsSource: getTreeData(),checkedItemsChanged: function (s, e) {console.log('dropDownTree.checkedItemsChanged:');s.checkedItems.forEach(function (item, index) {console.log(index, item[s.displayMemberPath])})}});// create the MultiSelectvar multiSelect = new wijmo.input.MultiSelect('#multiSelect', {itemsSource: 'Austria,Belgium,Chile,Denmark'.split(','),checkedItemsChanged: function (s, e) {console.log('multiSelect.checkedItemsChanged:');s.checkedItems.forEach(function (item, index) {console.log(index, item)})}});// get the tree datafunction getTreeData() {return [{ header: 'Electronics', img: 'resources/electronics.png', items: [{ header: 'Trimmers/Shavers' },{ header: 'Tablets' },{ header: 'Phones', img: 'resources/phones.png', items: [{ header: 'Apple' },{ header: 'Motorola', newItem: true },{ header: 'Nokia' },{ header: 'Samsung' }]},{ header: 'Speakers', newItem: true },{ header: 'Monitors' }]},{ header: 'Toys', img: 'resources/toys.png', items: [{ header: 'Shopkins' },{ header: 'Train Sets' },{ header: 'Science Kit', newItem: true },{ header: 'Play-Doh' },{ header: 'Crayola' }]},{ header: 'Home', img: 'resources/home.png', items: [{ header: 'Coffeee Maker' },{ header: 'Breadmaker', newItem: true },{ header: 'Solar Panel', newItem: true },{ header: 'Work Table' },{ header: 'Propane Grill' }]}];}
}// DropDownTree: transpiled TypeScript
var __extends = (this && this.__extends) || (function () {var extendStatics = Object.setPrototypeOf ||({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };return function (d, b) {extendStatics(d, b);function __() { this.constructor = d; }d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());};
})();
var wijmo;
(function (wijmo) {var input;(function (input) {var DropDownTree = /** @class */ (function (_super) {__extends(DropDownTree, _super);/*** Initializes a new instance of the @see:DropDownTree class.** @param element The DOM element that hosts the control, or a CSS selector for the host element (e.g. '#theCtrl').* @param options The JavaScript object containing initialization data for the control.*/function DropDownTree(element, options) {var _this = _super.call(this, element) || this;_this._maxHdrItems = 2;_this._hdrFmt = wijmo.culture.MultiSelect.itemsSelected;/*** Occurs when the value of the @see:checkedItems property changes.*/_this.checkedItemsChanged = new wijmo.Event();wijmo.addClass(_this.hostElement, 'wj-dropdowntree');// make header element read-only_this._tbx.readOnly = true;// toggle drop-down when clicking on the header element// (and not on a containing label element)_this.addEventListener(_this.inputElement, 'click', function (e) {if (document.elementFromPoint(e.clientX, e.clientY) == _this.inputElement) {_this.isDroppedDown = !_this.isDroppedDown;}});// update header now, when the itemsSource changes, and when items are selected_this._updateHeader();var tree = _this._tree;tree.checkedItemsChanged.addHandler(function () {_this._updateHeader();_this.onCheckedItemsChanged();});tree.selectedItemChanged.addHandler(function () {if (!tree.showCheckboxes) {_this._updateHeader();_this.onCheckedItemsChanged();}});tree.loadedItems.addHandler(function () {_this._updateHeader();});// close tree on enter/escapetree.addEventListener(tree.hostElement, 'keydown', function (e) {switch (e.keyCode) {case wijmo.Key.Enter:case wijmo.Key.Escape:_this.isDroppedDown = false;break;}});// initialize control options_this.initialize(options);return _this;}Object.defineProperty(DropDownTree.prototype, "treeView", {/*** Gets the @see:TreeView control shown in the drop-down.*/get: function () {return this._tree;},enumerable: true,configurable: true});Object.defineProperty(DropDownTree.prototype, "itemsSource", {/*** Gets or sets the array that contains the @see:TreeView items.** @see:TreeView #see:itemsSource arrays usually have a hierarchical* structure with items that contain child items. There is no fixed* limit to the depth of the items.** For details, see the @see:TreeView.itemsSource property.*/get: function () {return this._tree.itemsSource;},set: function (value) {this._tree.itemsSource = value;},enumerable: true,configurable: true});Object.defineProperty(DropDownTree.prototype, "displayMemberPath", {/*** Gets or sets the name of the property (or properties) to use as* the visual representation of the nodes.** The default value for this property is the string 'header'.** For details, see the @see:TreeView.displayMemberPath property.*/get: function () {return this._tree.displayMemberPath;},set: function (value) {this._tree.displayMemberPath = value;},enumerable: true,configurable: true});Object.defineProperty(DropDownTree.prototype, "childItemsPath", {/*** Gets or sets the name of the property (or properties) that contains* the child items for each node.** The default value for this property is the string 'items'.** For details, see the @see:TreeView.childItemsPath property.*/get: function () {return this._tree.childItemsPath;},set: function (value) {this._tree.childItemsPath = value;},enumerable: true,configurable: true});Object.defineProperty(DropDownTree.prototype, "showCheckboxes", {/*** Gets or sets a value that determines whether the @see:TreeView should* add checkboxes to nodes and manage their state.** For details, see the @see:TreeView.showCheckboxes property.*/get: function () {return this._tree.showCheckboxes;},set: function (value) {this._tree.showCheckboxes = value;},enumerable: true,configurable: true});Object.defineProperty(DropDownTree.prototype, "checkedItems", {/*** Gets or sets an array containing the items that are currently checked.*/get: function () {var tree = this._tree;if (tree.showCheckboxes) {return tree.checkedItems;}else {return tree.selectedItem ? [tree.selectedItem] : [];}},set: function (value) {var tree = this._tree;if (tree.showCheckboxes) {tree.checkedItems = wijmo.asArray(value);}else {tree.selectedItem = wijmo.isArray(value) ? value[0] : value;}},enumerable: true,configurable: true});Object.defineProperty(DropDownTree.prototype, "maxHeaderItems", {/*** Gets or sets the maximum number of items to display on the control header.** If no items are selected, the header displays the text specified by the* @see:placeholder property.** If the number of selected items is smaller than or equal to the value of the* @see:maxHeaderItems property, the selected items are shown in the header.** If the number of selected items is greater than @see:maxHeaderItems, the* header displays the selected item count instead.*/get: function () {return this._maxHdrItems;},set: function (value) {if (this._maxHdrItems != value) {this._maxHdrItems = wijmo.asNumber(value);this._updateHeader();}},enumerable: true,configurable: true});Object.defineProperty(DropDownTree.prototype, "headerFormat", {/*** Gets or sets the format string used to create the header content* when the control has more than @see:maxHeaderItems items checked.** The format string may contain the '{count}' replacement string* which gets replaced with the number of items currently checked.* The default value for this property in the English culture is* '{count:n0} items selected'.*/get: function () {return this._hdrFmt;},set: function (value) {if (value != this._hdrFmt) {this._hdrFmt = wijmo.asString(value);this._updateHeader();}},enumerable: true,configurable: true});Object.defineProperty(DropDownTree.prototype, "headerFormatter", {/*** Gets or sets a function that gets the HTML in the control header.** By default, the control header content is determined based on the* @see:placeholder, @see:maxHeaderItems, and on the current selection.** You may customize the header content by specifying a function that* returns a custom string based on whatever criteria your application* requires.*/get: function () {return this._hdrFormatter;},set: function (value) {if (value != this._hdrFormatter) {this._hdrFormatter = wijmo.asFunction(value);this._updateHeader();}},enumerable: true,configurable: true});/*** Raises the @see:checkedItemsChanged event.*/DropDownTree.prototype.onCheckedItemsChanged = function (e) {this.checkedItemsChanged.raise(this, e);};//** overrides// switch focus to the tree when the drop-down opensDropDownTree.prototype.onIsDroppedDownChanged = function (e) {if (this.containsFocus() && this.isDroppedDown) {this._tree.focus();}_super.prototype.onIsDroppedDownChanged.call(this, e);};// create the drop-down elementDropDownTree.prototype._createDropDown = function () {// create child TreeView controlvar lbHost = wijmo.createElement('<div style="width:100%;border:none"></div>', this._dropDown);this._tree = new wijmo.nav.TreeView(lbHost, {showCheckboxes: true,});// let base class do its thing_super.prototype._createDropDown.call(this);};Object.defineProperty(DropDownTree.prototype, "isReadOnly", {// override since our input is always read-onlyget: function () {return this._readOnly;},set: function (value) {this._readOnly = wijmo.asBoolean(value);wijmo.toggleClass(this.hostElement, 'wj-state-readonly', this.isReadOnly);},enumerable: true,configurable: true});// update header when refreshingDropDownTree.prototype.refresh = function (fullUpdate) {if (fullUpdate === void 0) { fullUpdate = true; }_super.prototype.refresh.call(this, fullUpdate);this._updateHeader();};//** implementation// update the value of the control headerDropDownTree.prototype._updateHeader = function () {// get selected itemsvar items = this.checkedItems;// update the headerif (wijmo.isFunction(this._hdrFormatter)) {this.inputElement.value = this._hdrFormatter();}else {var hdr = '';if (items.length > 0) {if (items.length <= this._maxHdrItems) {if (this.displayMemberPath) {var binding_1 = new wijmo.Binding(this.displayMemberPath);items = items.map(function (item) {return binding_1.getValue(item);});}hdr = items.join(', ');}else {hdr = wijmo.format(this.headerFormat, {count: items.length});}}this.inputElement.value = hdr;}// update wj-state attributesthis._updateState();};return DropDownTree;}(input.DropDown));input.DropDownTree = DropDownTree;})(input = wijmo.input || (wijmo.input = {}));
})(wijmo || (wijmo = {}));
//# sourceMappingURL=DropDownTree.js.map

CSS

body {margin-bottom: 24pt;}

控件准备就绪后,它将如下所示:

DropDownTree Control

Drop-Down-Tree

本控件使用两个独立的WijmoJS模块:输入和导航。所需的步骤与开发MultiSelect控件时所采用的步骤相同:

选择基类

在这种场景下,我们可以将DropDown控件进行扩展,该控件包含使用下拉按钮实现输入元素所需的所有逻辑以及可用于托管任何控件的通用下拉列表。 DropDown控件用作ComboBox,InputColor和InputDate控件的基类。

定义对象模型

因为DropDownTree控件在其下拉列表中托管TreeView,所以我们决定直接从DropDownTree公开TreeView控件的主要属性:

  • TreeView获取对下拉列表中显示的TreeView控件的引用。
  • ItemsSource获取或设置对用于填充TreeView的对象数组的引用。
  • DisplayMemberPath获取或设置用作项目可视化表示的属性名称(默认为“header”)。
  • ChildItemsPath获取或设置包含数据源中每个项的子项的属性的名称(默认为“items”)。
  • ShowCheckboxes获取或设置一个值,该值确定控件是否应为每个项添加复选框,以便用户可以选择多个项(默认为true)。

我们还添加了一些额外的属性和事件来定义当前选择以及它在控制头中的表示方式。这些属性镜像MultiSelect控件中的相应属性:

  • CheckedItems获取或设置包含当前所选项目的数组。
  • CheckedItemsChanged是CheckedItems属性值更改时发生的事件。
  • MaxHeaderItems是控件头中显示的最大选定项数。
  • 当控件具有超过*maxHeaderItems项目选项时,headerFormat获取或设置用于创建标题内容的格式字符串。
  • HeaderFormatter获取或设置一个函数,该函数获取控件头中显示的文本。 这将覆盖maxHeaderItems和headerFormat属性的设置。

实现控件

我们首先将控件声明为基类的扩展:

namespace wijmo.input {export class DropDownTree extends DropDown {}
}

“extendsDropDown”语句确保我们的控件继承基本DropDown类的所有功能,包括属性,事件,方法和所有内部/私有成员。

创建树视图

接下来,我们覆盖DropDown类中的_createDropDown方法,以创建将在下拉列表中显示的TreeView控件。

除了创建TreeView之外,我们还会覆盖onIsDroppedDownChanged方法,以便在下拉列表打开且控件具有焦点时将焦点转移到树。 这允许用户使用键盘导航树。 他们可以通过键入内容来搜索项目,通过按空格键来检查项目,或使用光标键导航树。

namespace wijmo.input {export class DropDownTree extends DropDown {private _tree: wijmo.nav.TreeView;// create the drop-down elementprotected _createDropDown() {// create child TreeView controllet lbHost = document.createElement('div');setCss(lbHost, {width: '100%',border: 'none'});this._tree = new wijmo.nav.TreeView(lbHost, {showCheckboxes: true});}// switch focus to the tree when the drop-down opensonIsDroppedDownChanged(e?: EventArgs) {if (this.containsFocus() && this.isDroppedDown) {this._tree.focus();}super.onIsDroppedDownChanged(e);}}
}

公开TreeView及其属性

下一步是添加公开TreeView及其主要属性:

namespace wijmo.input {export class DropDownTree extends DropDown {private _tree: wijmo.nav.TreeView;get treeView(): wijmo.nav.TreeView {return this._tree;}get itemsSource(): any[] {return this._tree.itemsSource;}set itemsSource(value: any[]) {this._tree.itemsSource = value;}// same for displayMemberPath, childItemsPath, // and showCheckboxes// create the drop-down elementprotected _createDropDown() {…}}
}

这些属性只是获取或设置包含的TreeView上的相应属性的快捷方式。 因此,它们非常简单,我们甚至不启用类型检查,因为TreeView将为我们处理。

CheckedItems属性

控件的主要属性是CheckedItems,它用来表示用户当前已获取和自定义的数组。 我们可以用它实现上面那样的传递属性,也可以实现多选和单选功能。比如想实现其单选功能时,我们需要检查ShowCheckboxes属性的值并使用树的checkedItems或selectedItem属性。

除了CheckedItems属性,我们还实现了checkedItemsChanged事件及其伴随方法onCheckedItemsChanged。 这是WijmoJS事件的标准模式。 每个事件X都有一个相应的onX方法,负责触发事件。

namespace wijmo.input {export class DropDownTree extends DropDown {private _tree: wijmo.nav.TreeView;// TreeView pass-through properties…get checkedItems(): any[] {let tree = this._tree;if (tree.showCheckboxes) {return tree.checkedItems;} else {return tree.selectedItem? [tree.selectedItem] : [];}}set checkedItems(value: any[]) {let tree = this._tree;if (tree.showCheckboxes) {tree.checkedItems = asArray(value);} else {tree.selectedItem = isArray(value)? value[0] : value;}}readonly checkedItemsChanged = new Event();onCheckedItemsChanged(e?: EventArgs) {this.checkedItemsChanged.raise(this, e);}// create the drop-down elementprotected _createDropDown() {…}
}

请注意,即使在单个选择的情况下,checkedItems属性也会返回一个数组(该数组为空或包含单个元素)。

更新控件头

这里不会重点讨论maxHeaderItems,headerFormat或headerFormatter属性的实现方式,因为它们很简单。我们需要将目光聚焦在_updateHeader函数的逻辑中,该函数使用这些属性,并在其值或选择更改时自动调用以更新控件头:

namespace wijmo.input {export class DropDownTree extends DropDown {private _tree: wijmo.nav.TreeView;// TreeView pass-through properties…// checketItems property…private _updateHeader() {let items = this.checkedItems;if (isFunction(this._hdrFormatter)) {this.inputElement.value = this._hdrFormatter();} else {let hdr = '';if (items.length > 0) {if (items.length <= this._maxHdrItems) {if (this.displayMemberPath) {let dmp = this.displayMemberPath,binding = new Binding(dmp);items = items.map((item) => {return binding.getValue(item);});}hdr = items.join(', ');} else {hdr = format(this.headerFormat, {count: items.length});}}this.inputElement.value = hdr;}}// create the drop-down elementprotected _createDropDown() {…}}
}

构造函数

到此为止,我们几乎已经完成了控件架构。最后一步是实现构造函数,该构造函数将部件与事件侦听器连接,并调用initialize方法以使用options参数中的用户提供的值初始化属性和事件处理程序:

namespace wijmo.input {export class DropDownTree extends DropDown {private _tree: wijmo.nav.TreeView;private _readOnly: boolean;private _maxHdrItems = 2;private _hdrFmt = wijmo.culture.MultiSelect.itemsSelected;private _hdrFormatter: Function;constructor(element: HTMLElement, options?: any) {super(element);addClass(this.hostElement, 'wj-dropdowntree');// make header element read-onlythis._tbx.readOnly = true;// update header now, when the itemsSource changes, // and when items are selectedthis._updateHeader();let tree = this._tree;tree.checkedItemsChanged.addHandler(() => {this._updateHeader();this.onCheckedItemsChanged();});tree.selectedItemChanged.addHandler(() => {if (!tree.showCheckboxes) {this._updateHeader();this.onCheckedItemsChanged();}});tree.loadedItems.addHandler(() => {this._updateHeader();});// initialize control optionsthis.initialize(options);}// TreeView pass-through properties…// checketItems property…// _updateHeader implementation…// _createDropDown implementation…}
}

测试控件

现在控件已准备好,我们可以测试它,并检查它是否按照我们想要的方式运行。

运行DropDownTree 控件源代码,单击下拉按钮以打开TreeView。 打开后,单击几个项目以选择它们,并注意控件头的更新方式:

Drop-Down-Tree

我们由衷希望DropDownTree控件对您产生帮助。更重要的是,我们希望您现在可以放心地将DropDown控件扩展为托管其他类型的元素,同时创建自己的自定义控件。


WijmoJS:灵活高效的前端开发工具包,可快速搭建企业 Web 应用程序
图片描述


http://chatgpt.dhexx.cn/article/npvr6awp.shtml

相关文章

nodejs+express搭建javascript在线IDE及CodeMirror代码提示问题

title: js在线学习平台的介绍及安装 nodejsexpress搭建javascript在线IDE 项目地址 github:https://github.com/sixtrees/js-online-running 背景 这两天在看阮一峰的《ES6标准入门》&#xff0c;对其中涉及到的代码示例部分&#xff0c;感觉到很不方便&#xff0c;不知道阮老师…

Winform中实现向窗体中拖放照片并显示以及拖放文件夹显示树形结构(附代码下载)

场景 向窗体中拖拽照片并显示效果 向窗体中拖拽文件夹并显示树形结构效果 注&#xff1a; 博客主页&#xff1a; https://blog.csdn.net/badao_liumang_qizhi 关注公众号 霸道的程序猿 获取编程相关电子书、教程推送与免费下载。 实现 新建一个窗体&#xff0c;在窗体中拖…

Day 21-30 :Web前端概述

Web前端概述 说明&#xff1a;本文使用的部分插图来自Jon Duckett先生的*HTML and CSS: Design and Build Websites*一书&#xff0c;这是一本非常棒的前端入门书&#xff0c;有兴趣的读者可以在亚马逊或者其他网站上找到该书的购买链接。 HTML 是用来描述网页的一种语言&#…

托管 AJAX 能否让 Web 应用程序提速?

有关本主题的多项研究表明&#xff0c;创建 AJAX Web 应用程序时遇到的两个最重要问题是&#xff0c;运行速度和响应速度。这可能是一些开发者选择创建原生应用程序&#xff08;而不是 Web 应用程序&#xff09;的部分原因所在。 但如果我说有一种方法可以创建运行速度和响应速…

数据库实验代码展示(图书管理系统)

数据库实验视频演示及讲解地址 namespace BookManageSystem {partial class Add_BookInfo{/// <summary>/// Required designer variable./// </summary>private System.ComponentModel.IContainer components = null;/// <summary>/// Clean up any resou…

【C#】利用C#窗体与SQL Server的连接、Treeview制作SQL Server数据库查看器

实质上&#xff0c;本文的中心还是在讨论C#对SQL Server的增删改查&#xff0c;只是这次创新一点&#xff0c;配合Treeview制作SQL Server数据库查看器。 具体如下图&#xff1a; 根据SQL Server&#xff0c;Test数据库中的表的结构与内容&#xff1a; 编写一个对Test数据库的…

获取文件夹内文件名字及源代码C#

获取文件夹内文件名字及源代码C# using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks…

TreeView控件与SQL数据库的应用(遍历算法)

开发环境&#xff1a;WinXP SP3&#xff0c;VS2008&#xff0c;SQL2000 TreeView控件与SQL数据库的应用(遍历算法) (数据与TreeView的绑定及Treeview的增加、删除、修改、遍历等数据库的操作) 这个是数据库连接及一些操作数据库的方法&#xff0c;文件&#xff1a;SqlManager.c…

TreeView数据绑定

http://www.cnblogs.com/mgen/archive/2011/07/21/2113152.html [更新至V2]WPF&#xff1a;MVVM简单文件浏览器 源代码下载 2.0 下载页面 1.0 下载页面 注意&#xff1a;链接是微软SkyDrive页面&#xff0c;下载时请用浏览器直接下载&#xff0c;用某些下载工具可能无法下载 源…

C#界面设计之树目录TreeView的使用

还是先上效果图&#xff1a; 主要代码如下&#xff1a; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms;namespace TreeDemo {public partial c…

treeview 跨窗体拖拽功能的实现(一)

功能实现&#xff1a; 1.从工具窗体往任务窗体拖拽&#xff1b; 2.在任务窗体中改变节点的顺序&#xff1b; 3.右键复制节点&#xff0c;删除节点 工具窗体treeview1,&#xff1a; 涉及使用的事件&#xff1a;DragEnter&#xff0c; DragOver ,ItemDrag, NodeMouseDouble…

Virtual Treeview 安装以及入门

Virtual Treeview是一套Delphi下优秀的VCL控件&#xff0c;代码质量高&#xff0c;使用灵活、功能强大、性能非常好&#xff0c;可以用于表达Treeview和表格类数据。它的代码现在托管在google code上。 Virtual Treeview是一个“纯VCL”控件&#xff0c;这意味着它不是基于任何…

android treeview 树形结构,前端开发中,使用TreeView控件创建树形结构

原标题&#xff1a;前端开发中&#xff0c;使用TreeView控件创建树形结构 Wijmo是一款使用Type编写的新一代Java/HTML5控件集。它秉承触控优先的设计理念&#xff0c;在全球率先支持AngularJS&#xff0c;并提供性能卓越、零依赖的FlexGrid和图表等多个控件。 我们已经知道在Wi…

透透彻彻了解服务器技术

什么是服务器   服务器是一种高性能计算机&#xff0c;作为网络的节点&#xff0c;存储、处理网络上80&#xff05;的数据、信息&#xff0c;因此也被称为网络的灵魂。做一个形象的比喻&#xff1a;服务器就像是邮局的交换机&#xff0c;而微机、笔记本、PDA、手机等固定或移…

服务器的介绍

一 、IDC/机柜/物理server/云主机介绍 1.互联网数据中心 &#xff08;Internet Data Center&#xff09; 互联网数据中心图片 &#xff08;1&#xff09;IDC的简介 简称IDC&#xff0c;是电信部门利用已有的互联网通信线路、带宽资源&#xff0c;建立的标准化电信专业级机房环…

web服务器(技术讲解)

2.Web服务器&#xff08;技术讲解&#xff09; 1.ASP 微软&#xff1a;国内最早流行在HTML中嵌入了VB脚本&#xff0c;ASPCOM在ASP开发中&#xff0c;基本一个页面有几千行的业务代码&#xff0c;页面杂乱&#xff0c;维护成本非常高 2.PHP 开发速度很快&#xff0c;功能强…

关于服务器

初始服务器 云操作 以下是重装系统操作 出现黑窗口后&#xff1a; 输入—>sudo passwd命令–>输入密码&#xff08;密码不可见&#xff09;–>再次输入密码&#xff08;密码不可见&#xff09;–>su命令&#xff08;可使用root用户&#xff09;–>输入密码&…

云服务器简介

云服务器简介 一、云服务器二、云服务的灵魂——虚拟化三、云服务器ECS概念 一、云服务器 1、云服务器简介 云计算服务器又称为云服务器或云主机&#xff0c;是云计算服务体系中的一项主机产品&#xff0c;它有效地解决了传统物理主机与VPS服务中&#xff0c;存在的管理难度打…

服务器概述

1、什么是服务器&#xff1f; 服务器&#xff1a;分为服务器硬件和服务器软件。在硬件服务器&#xff08;计算机&#xff09;上安装服务器软件&#xff0c;才可以对外提供服务。 比如&#xff1a;让其他的计算机访问当前服务器&#xff0c;为其他的计算机提供服务。 &#xff…

服务器技术(三)--Nginx

Nginx介绍 Nginx是什么、适用场景 Nginx是一个高性能的HTTP和反向代理服务器&#xff0c;特点是占有内存少&#xff0c;并发能力强&#xff0c;事实上nginx的并发能力确实在同类型的网页服务器中表现较好。 Nginx专为性能优化而开发&#xff0c;性能是其最重要的考量&#xf…