C# 操作文件夹、文件
Form
namespace FileProperties
{
public partial class Form1 : Form
{
private string currentFolderPath; public Form1()
{
InitializeComponent();
} protected void ClearAllFields()
{
listBoxFolders.Items.Clear();
listBoxFiles.Items.Clear();
textBoxFolder.Text = "";
textBoxFolder.Text = "";
textBoxFileName.Text = "";
textBoxCreationTime.Text = "";
textBoxLastAccessTime.Text = "";
textBoxLastWriteTime.Text = "";
textBoxFileSize.Text = "";
} protected void DisplayFileInfo(string fileFullName)
{
FileInfo theFile = new FileInfo(fileFullName);
if (!theFile.Exists)
throw new FileNotFoundException("File not found: " + fileFullName);
textBoxFileName.Text = theFile.Name;
textBoxCreationTime.Text = theFile.CreationTime.ToLongTimeString();
textBoxLastAccessTime.Text = theFile.LastAccessTime.ToLongDateString();
textBoxLastWriteTime.Text = theFile.LastWriteTime.ToLongDateString();
textBoxFileSize.Text = theFile.Length + " bytes"; // enable move, copy, delete buttons
textBoxNewPath.Text = theFile.FullName;
textBoxNewPath.Enabled = true;
buttonCopyTo.Enabled = true;
buttonDelete.Enabled = true;
buttonMoveTo.Enabled = true;
} protected void DisplayFolderList(string folderFullName)
{
DirectoryInfo theFolder = new DirectoryInfo(folderFullName);
if (!theFolder.Exists)
throw new DirectoryNotFoundException("Folder not found: "
+ folderFullName);
ClearAllFields();
DisableMoveFeatures();
textBoxFolder.Text = theFolder.FullName;
currentFolderPath = theFolder.FullName; // list all subfolders in folder foreach (DirectoryInfo nextFolder in theFolder.GetDirectories())
listBoxFolders.Items.Add(nextFolder.Name); // list all files in folder foreach (FileInfo nextFile in theFolder.GetFiles())
listBoxFiles.Items.Add(nextFile.Name);
} protected void OnDisplayButtonClick(object sender, EventArgs e)
{
try
{
string folderPath = textBoxInput.Text;
DirectoryInfo theFolder = new DirectoryInfo(folderPath);
if (theFolder.Exists)
{
DisplayFolderList(theFolder.FullName);
return;
}
FileInfo theFile = new FileInfo(folderPath);
if (theFile.Exists)
{
DisplayFolderList(theFile.Directory.FullName);
int index = listBoxFiles.Items.IndexOf(theFile.Name);
listBoxFiles.SetSelected(index, true);
return;
}
throw new FileNotFoundException("There is no file or folder with "
+ "this name: " + textBoxInput.Text);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
} void DisableMoveFeatures()
{
textBoxNewPath.Text = "";
textBoxNewPath.Enabled = false;
buttonCopyTo.Enabled = false;
buttonDelete.Enabled = false;
buttonMoveTo.Enabled = false;
} protected void OnListBoxFilesSelected(object sender, EventArgs e)
{
try
{
string selectedString = listBoxFiles.SelectedItem.ToString();
string fullFileName = Path.Combine(currentFolderPath, selectedString);
DisplayFileInfo(fullFileName);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
} protected void OnListBoxFoldersSelected(object sender, EventArgs e)
{
try
{
string selectedString = listBoxFolders.SelectedItem.ToString();
string fullPathName = Path.Combine(currentFolderPath, selectedString);
DisplayFolderList(fullPathName);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
} protected void OnUpButtonClick(object sender, EventArgs e)
{
try
{
string folderPath = new FileInfo(currentFolderPath).DirectoryName;
DisplayFolderList(folderPath);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
} protected void OnDeleteButtonClick(object sender, EventArgs e)
{
try
{
string filePath = Path.Combine(currentFolderPath,
textBoxFileName.Text);
string query = "Really delete the file\n" + filePath + "?";
if (MessageBox.Show(query,
"Delete File?", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
File.Delete(filePath);
DisplayFolderList(currentFolderPath);
}
}
catch (Exception ex)
{
MessageBox.Show("Unable to delete file. The following exception"
+ " occurred:\n" + ex.Message, "Failed");
}
} protected void OnMoveButtonClick(object sender, EventArgs e)
{
try
{
string filePath = Path.Combine(currentFolderPath,
textBoxFileName.Text);
string query = "Really move the file\n" + filePath + "\nto "
+ textBoxNewPath.Text + "?";
if (MessageBox.Show(query,
"Move File?", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
File.Move(filePath, textBoxNewPath.Text);
DisplayFolderList(currentFolderPath);
}
}
catch (Exception ex)
{
MessageBox.Show("Unable to move file. The following exception"
+ " occurred:\n" + ex.Message, "Failed");
}
}
protected void OnCopyButtonClick(object sender, EventArgs e)
{
try
{
string filePath = Path.Combine(currentFolderPath,
textBoxFileName.Text);
string query = "Really copy the file\n" + filePath + "\nto "
+ textBoxNewPath.Text + "?";
if (MessageBox.Show(query,
"Copy File?", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
File.Copy(filePath, textBoxNewPath.Text);
DisplayFolderList(currentFolderPath);
}
}
catch (Exception ex)
{
MessageBox.Show("Unable to copy file. The following exception"
+ " occurred:\n" + ex.Message, "Failed");
}
}
}
}
Designer
namespace FileProperties
{ partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null; /// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
} #region Windows Form Designer generated code /// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.label14 = new System.Windows.Forms.Label();
this.textBoxNewPath = new System.Windows.Forms.TextBox();
this.buttonDelete = new System.Windows.Forms.Button();
this.buttonCopyTo = new System.Windows.Forms.Button();
this.buttonMoveTo = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.textBoxLastAccessTime = new System.Windows.Forms.TextBox();
this.textBoxLastWriteTime = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.textBoxCreationTime = new System.Windows.Forms.TextBox();
this.textBoxFileSize = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.buttonDisplay = new System.Windows.Forms.Button();
this.textBoxFolder = new System.Windows.Forms.TextBox();
this.buttonUp = new System.Windows.Forms.Button();
this.textBoxInput = new System.Windows.Forms.TextBox();
this.textBoxFileName = new System.Windows.Forms.TextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.listBoxFiles = new System.Windows.Forms.ListBox();
this.listBoxFolders = new System.Windows.Forms.ListBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox5.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// groupBox5
//
this.groupBox5.Controls.Add(this.label14);
this.groupBox5.Controls.Add(this.textBoxNewPath);
this.groupBox5.Controls.Add(this.buttonDelete);
this.groupBox5.Controls.Add(this.buttonCopyTo);
this.groupBox5.Controls.Add(this.buttonMoveTo);
this.groupBox5.Location = new System.Drawing.Point(, );
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(, );
this.groupBox5.TabIndex = ;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Move, Delete or Copy File";
//
// label14
//
this.label14.Location = new System.Drawing.Point(, );
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(, );
this.label14.TabIndex = ;
this.label14.Text = "New Location";
//
// textBoxNewPath
//
this.textBoxNewPath.Location = new System.Drawing.Point(, );
this.textBoxNewPath.Name = "textBoxNewPath";
this.textBoxNewPath.Size = new System.Drawing.Size(, );
this.textBoxNewPath.TabIndex = ;
//
// buttonDelete
//
this.buttonDelete.Location = new System.Drawing.Point(, );
this.buttonDelete.Name = "buttonDelete";
this.buttonDelete.Size = new System.Drawing.Size(, );
this.buttonDelete.TabIndex = ;
this.buttonDelete.Text = "Delete";
this.buttonDelete.Click += new System.EventHandler(this.OnDeleteButtonClick);
//
// buttonCopyTo
//
this.buttonCopyTo.Location = new System.Drawing.Point(, );
this.buttonCopyTo.Name = "buttonCopyTo";
this.buttonCopyTo.Size = new System.Drawing.Size(, );
this.buttonCopyTo.TabIndex = ;
this.buttonCopyTo.Text = "Copy To";
this.buttonCopyTo.Click += new System.EventHandler(this.OnCopyButtonClick);
//
// buttonMoveTo
//
this.buttonMoveTo.Location = new System.Drawing.Point(, );
this.buttonMoveTo.Name = "buttonMoveTo";
this.buttonMoveTo.Size = new System.Drawing.Size(, );
this.buttonMoveTo.TabIndex = ;
this.buttonMoveTo.Text = "Move To";
this.buttonMoveTo.Click += new System.EventHandler(this.OnMoveButtonClick);
//
// label3
//
this.label3.Location = new System.Drawing.Point(, );
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(, );
this.label3.TabIndex = ;
this.label3.Text = "Creation time";
//
// textBoxLastAccessTime
//
this.textBoxLastAccessTime.Enabled = false;
this.textBoxLastAccessTime.Location = new System.Drawing.Point(, );
this.textBoxLastAccessTime.Name = "textBoxLastAccessTime";
this.textBoxLastAccessTime.Size = new System.Drawing.Size(, );
this.textBoxLastAccessTime.TabIndex = ;
//
// textBoxLastWriteTime
//
this.textBoxLastWriteTime.Enabled = false;
this.textBoxLastWriteTime.Location = new System.Drawing.Point(, );
this.textBoxLastWriteTime.Name = "textBoxLastWriteTime";
this.textBoxLastWriteTime.Size = new System.Drawing.Size(, );
this.textBoxLastWriteTime.TabIndex = ;
//
// label6
//
this.label6.Location = new System.Drawing.Point(, );
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(, );
this.label6.TabIndex = ;
this.label6.Text = "Last modification time";
//
// label1
//
this.label1.Location = new System.Drawing.Point(, );
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(, );
this.label1.TabIndex = ;
this.label1.Text = "Enter name of folder to be examined and click Display";
//
// label5
//
this.label5.Location = new System.Drawing.Point(, );
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(, );
this.label5.TabIndex = ;
this.label5.Text = "Last access time";
//
// textBoxCreationTime
//
this.textBoxCreationTime.Enabled = false;
this.textBoxCreationTime.Location = new System.Drawing.Point(, );
this.textBoxCreationTime.Name = "textBoxCreationTime";
this.textBoxCreationTime.Size = new System.Drawing.Size(, );
this.textBoxCreationTime.TabIndex = ;
//
// textBoxFileSize
//
this.textBoxFileSize.Enabled = false;
this.textBoxFileSize.Location = new System.Drawing.Point(, );
this.textBoxFileSize.Name = "textBoxFileSize";
this.textBoxFileSize.Size = new System.Drawing.Size(, );
this.textBoxFileSize.TabIndex = ;
//
// label7
//
this.label7.Location = new System.Drawing.Point(, );
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(, );
this.label7.TabIndex = ;
this.label7.Text = "File Size";
//
// label8
//
this.label8.Location = new System.Drawing.Point(, );
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(, );
this.label8.TabIndex = ;
this.label8.Text = "Folders";
//
// label2
//
this.label2.Location = new System.Drawing.Point(, );
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(, );
this.label2.TabIndex = ;
this.label2.Text = "Files";
//
// label4
//
this.label4.Location = new System.Drawing.Point(, );
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(, );
this.label4.TabIndex = ;
this.label4.Text = "File name";
//
// buttonDisplay
//
this.buttonDisplay.Location = new System.Drawing.Point(, );
this.buttonDisplay.Name = "buttonDisplay";
this.buttonDisplay.Size = new System.Drawing.Size(, );
this.buttonDisplay.TabIndex = ;
this.buttonDisplay.Text = "Display";
this.buttonDisplay.Click += new System.EventHandler(this.OnDisplayButtonClick);
//
// textBoxFolder
//
this.textBoxFolder.Enabled = false;
this.textBoxFolder.Location = new System.Drawing.Point(, );
this.textBoxFolder.Name = "textBoxFolder";
this.textBoxFolder.Size = new System.Drawing.Size(, );
this.textBoxFolder.TabIndex = ;
//
// buttonUp
//
this.buttonUp.Location = new System.Drawing.Point(, );
this.buttonUp.Name = "buttonUp";
this.buttonUp.Size = new System.Drawing.Size(, );
this.buttonUp.TabIndex = ;
this.buttonUp.Text = "Up";
this.buttonUp.Click += new System.EventHandler(this.OnUpButtonClick);
//
// textBoxInput
//
this.textBoxInput.Location = new System.Drawing.Point(, );
this.textBoxInput.Name = "textBoxInput";
this.textBoxInput.Size = new System.Drawing.Size(, );
this.textBoxInput.TabIndex = ;
//
// textBoxFileName
//
this.textBoxFileName.Enabled = false;
this.textBoxFileName.Location = new System.Drawing.Point(, );
this.textBoxFileName.Name = "textBoxFileName";
this.textBoxFileName.Size = new System.Drawing.Size(, );
this.textBoxFileName.TabIndex = ;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.textBoxLastAccessTime);
this.groupBox2.Controls.Add(this.textBoxCreationTime);
this.groupBox2.Controls.Add(this.textBoxLastWriteTime);
this.groupBox2.Location = new System.Drawing.Point(, );
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(, );
this.groupBox2.TabIndex = ;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Details of Selected File";
//
// listBoxFiles
//
this.listBoxFiles.Location = new System.Drawing.Point(, );
this.listBoxFiles.Name = "listBoxFiles";
this.listBoxFiles.Size = new System.Drawing.Size(, );
this.listBoxFiles.TabIndex = ;
this.listBoxFiles.SelectedIndexChanged += new System.EventHandler(this.OnListBoxFilesSelected);
//
// listBoxFolders
//
this.listBoxFolders.Location = new System.Drawing.Point(, );
this.listBoxFolders.Name = "listBoxFolders";
this.listBoxFolders.Size = new System.Drawing.Size(, );
this.listBoxFolders.TabIndex = ;
this.listBoxFolders.SelectedIndexChanged += new System.EventHandler(this.OnListBoxFoldersSelected);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.groupBox5);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.textBoxFileSize);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.textBoxFileName);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.textBoxFolder);
this.groupBox1.Controls.Add(this.groupBox2);
this.groupBox1.Location = new System.Drawing.Point(, );
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(, );
this.groupBox1.TabIndex = ;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Contents of folder";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(, );
this.Controls.Add(this.label1);
this.Controls.Add(this.label8);
this.Controls.Add(this.label2);
this.Controls.Add(this.buttonDisplay);
this.Controls.Add(this.buttonUp);
this.Controls.Add(this.textBoxInput);
this.Controls.Add(this.listBoxFiles);
this.Controls.Add(this.listBoxFolders);
this.Controls.Add(this.groupBox1);
this.Name = "Form1";
this.Text = "FilePropertiesAndMovement Sample";
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout(); } #endregion private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.TextBox textBoxNewPath;
private System.Windows.Forms.Button buttonDelete;
private System.Windows.Forms.Button buttonCopyTo;
private System.Windows.Forms.Button buttonMoveTo;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBoxLastAccessTime;
private System.Windows.Forms.TextBox textBoxLastWriteTime;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox textBoxCreationTime;
private System.Windows.Forms.TextBox textBoxFileSize;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button buttonDisplay;
private System.Windows.Forms.TextBox textBoxFolder;
private System.Windows.Forms.Button buttonUp;
private System.Windows.Forms.TextBox textBoxInput;
private System.Windows.Forms.TextBox textBoxFileName;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.ListBox listBoxFiles;
private System.Windows.Forms.ListBox listBoxFolders;
private System.Windows.Forms.GroupBox groupBox1; }
}
C# 操作文件夹、文件的更多相关文章
- python 遍历文件夹 文件
python 遍历文件夹 文件 import os import os.path rootdir = "d:\data" # 指明被遍历的文件夹 for parent,dirn ...
- android多国语言文件夹文件汇总
android多国语言文件夹文件汇总如下: 中文(中国):values-zh-rCN 中文(台湾):values-zh-rTW 中文(香港):values-zh-rHK 英语(美国):values-e ...
- java基础IO删除文件夹文件
/** * 定义一个方法,能够删除任意文件夹,文件夹路径由键盘录入 注意:不要在C盘下做测试,请选定无用的文件夹测试! */ 1.键盘录入 private static File getfile() ...
- PHP文件夹文件拷贝/复制函数 dir_copy($src = '', $dst = '')
/* * 文件夹文件拷贝 * * @param string $src 来源文件夹 * @param string $dst 目的地文件夹 * @return bool */ function dir ...
- java实现基于关键字的文件夹(文件)的搜索、文件夹(文件)的复制、删除
最近在做一个项目,需要实现这几项功能,上网查了很多资料,自己研究了好几天终于实现了,现在与大家分享一下. 一.JAVA实现文件夹的搜索 在百度搜索N个技术文章,从哪些大牛们共享的资料中终于写出了我 ...
- JavaSE 文件递归之删除&获取文件夹文件夹中全部的以.jpg的文件的绝对路径
1.递归删除文件 假设一个文件夹以下还有子文件夹,进行删除的话会 报错,这个时候要使用递归的方式来删除这个文件文件夹中的全部文件以及文件夹 package cn.itcast.digui; impor ...
- Shell脚本递归打印指定文件夹中全部文件夹文件
#!/bin/bash #递归打印当前文件夹下的全部文件夹文件. PRINTF() { ls $1 | while read line #一次读取每一行放到line变量中 do [ -d $1/$li ...
- C#获取文件夹/文件的大小以及占用空间 转摘自:http://www.cnblogs.com/chenpeng-dota/articles/2176470.html
C#获取文件夹/文件的大小以及占用空间 今天,头给了个任务:写个方法,我会给你个路径,计算这个路径所占用的磁盘空间 . 然后,找了很多资料.但大部分都是获取文件夹/文件的大小的.对于占用空间的没有成品 ...
- C# 压缩 解压 复制文件夹,文件的操作
命名空间:namespace System.IO.Compression 压缩: //目标文件夹 string fileDirPath = "/Downloads/试题" + us ...
- 文件夹文件遍历并插入数据库的操作,IO Directory File的递归操作
在我们管理内容管理系统时,数据量大时,对机器的依赖性就比较强了,比如,我要将一个文件夹中的很多图片上传到网站,一个个上传会很花时间,就想到了通过遍历文件夹得到文件名,并将路径与文件保存到数据库中对应的 ...
随机推荐
- Mac10.14.6安装Python3
换了台新电脑, 记录一下Python3的安装过程. 1.检查现有版本的python. 因为Mac的系统以来python2, 所以python肯定是有的, 因为依赖, 所以安装了python3, 也不可 ...
- [转帖]Oracle数据安全--校验Oracle安装软件的 SHA码 防范注入风险
Oracle数据安全--校验Oracle安装软件的 SHA码 防范注入风险 https://www.toutiao.com/i6723512458482303499/ certutil md5sums ...
- WUSTOJ 1277: 小吉吉读书(Java)
1277: 小吉吉读书 题目 有一本 n 页的书,每天都看 ai 页,已知星期 k 买的书,问星期几能看完?更多内容点击标题. 分析 统计出一个星期能看 a 页,看了 a 页又会回到买书的那一 ...
- 结合python实现的netcat与python实现的tcp代理,建立一个流量隧道
在proxy中 python2 proxy.py 127.0.0.1 3334 192.158.1.111 80 true 作为服务器在本地3334端口进行监听, 作为客户端连接远程web服务器192 ...
- Go part 2 基础语法
关键字.标识符 标识符: 是用户或系统定义的有意义单词组合,或单词与数字组合(具体意义有定义者决定) 标识符以字母下划线开头,大小写敏感,比如:boy, Boy, _boy, _(匿名变量,用来 ...
- 0.a开始数据结构征程
决定开始从mooc和ppt上学习数据结构,......书暂时不看.在进入数据结构之前,我首先将自己以一个还未进入大山但又向往山中美景的探险者身份对数据结构的几点疑问的答案的寻找和思考写在下面. 什么是 ...
- @PostConstruct注解原理解析
所有文章 https://www.cnblogs.com/lay2017/p/11478237.html 正文 @PostConstruct注解使用简介 在了解一个东西的原理之前,我们得初步的懂得如何 ...
- Python中的一些常用模块1
OS模块,sys模块,time模块,random模块,序列化模块 os模块是与操作系统交互的一个接口 OS模块简单的来说是一个Python的系统编程操作模块,可以处理文件和目录这些我们日常手动需要做的 ...
- 关于微信小程序使用watch监听数据变化的方法
众所周知,Vue中,可以使用监听属性 watch来观察和响应 Vue 实例上的数据变化,那么小程序能不能实现这一点呢? 监听器的原理,是将data中需监听的数据写在watch对象中,并给其提供一个方法 ...
- form-create教程:自定义布局,实现一行多个组件
本文将介绍form-create如何自定义布局,实现一行多个组件 form-create 是一个可以通过 JSON 生成具有动态渲染.数据收集.验证和提交功能的表单生成器.并且支持生成任何 Vue 组 ...