Rong.Volo.Abp.CodeGenerator.Vue
0.2.3
.NET 7.0
This package targets .NET 7.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Rong.Volo.Abp.CodeGenerator.Vue --version 0.2.3
NuGet\Install-Package Rong.Volo.Abp.CodeGenerator.Vue -Version 0.2.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rong.Volo.Abp.CodeGenerator.Vue" Version="0.2.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Rong.Volo.Abp.CodeGenerator.Vue --version 0.2.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Rong.Volo.Abp.CodeGenerator.Vue, 0.2.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Rong.Volo.Abp.CodeGenerator.Vue as a Cake Addin #addin nuget:?package=Rong.Volo.Abp.CodeGenerator.Vue&version=0.2.3 // Install Rong.Volo.Abp.CodeGenerator.Vue as a Cake Tool #tool nuget:?package=Rong.Volo.Abp.CodeGenerator.Vue&version=0.2.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
1.在你的 AbpModule 中 依赖 CodeGeneratorVueModule 模块
[DependsOn(
……
//代码生成模块
typeof(CodeGeneratorVueModule)
……
)]
public class YourModule : AbpModule
2.特殊组件
针对 枚举下拉组件,字典下拉组件,bool 下拉组件,文件上传组件,文件预览组件,可通过 CodeGeneratorVueOptions 配置来指定,不指定则使用默认组件:
//vue代码生成器
Configure<CodeGeneratorVueOptions>(options =>
{
//Vben 组件替换
options.ComponentMapForVben = new();
//枚举Select
options.EnumSelectComponent = "EnumSelect";
options.EnumSelectComponentProp = "code";
//枚举Radio
options.EnumRadioComponent = "EnumRadio";
options.EnumRadioComponentProp = "code";
//字典Select
options.DictionarySelectComponent = "DictSelect";
options.DictionarySelectComponentProp = "code";
//字典Radio
options.DictionaryRadioComponent = "DictRadio";
options.DictionaryRadioComponentProp = "code";
//bool
options.BoolSelectComponent = "BoolSelect";
options.BoolRadioComponent = "BoolRadio";
//文件上传
options.FileUploadComponent = "GzUploadFile";
//图片上传
options.ImageUploadComponent = "GzUploadFile";
//文件预览
options.FilePreviewComponent = "GzUploadFile";
options.FilePreviewComponentProp = "v-model";
//图片预览
options.ImagePreviewComponent = "GzImagePreview";
options.ImagePreviewComponentProp = "fileId";
});
3.使用
依赖注入 CodeGeneratorVueStore 来生成
例子:创建如下控制器,运行 http://localhost:端口/codevue/go ,返回 ok 则生成成功
public class CodeVueController : AbpController
{
private readonly CodeGeneratorVueStore _codeGeneratorStore;
public CodeVueController(CodeGeneratorVueStore codeGeneratorStore)
{
_codeGeneratorStore = codeGeneratorStore;
}
/// <summary>
/// 代码生成
/// </summary>
/// <returns></returns>+
public async Task<ActionResult> GoAsync()
{
List<TemplateVueModel> list = new List<TemplateVueModel>();
var entitys = typeof(CodeGeneratorDomainModule).Assembly.GetTypes()
.Where(x => typeof(IEntity).IsAssignableFrom(x));
var dtos = typeof(CodeGeneratorApplicationContractsModule).Assembly.GetTypes();
foreach (var entity in entitys)
{
var name = entity.Name;
var displayName = entity.GetCustomAttribute<TableAttribute>()?.Name??entity.GetXmlDocsSummary();
var page = dtos.FirstOrDefault(a => a.Name == $"{name}PageOutput");
var search = dtos.FirstOrDefault(a => a.Name == $"{name}PageSearchInput");
var create = dtos.FirstOrDefault(a => a.Name == $"{name}CreateInput");
var update = dtos.FirstOrDefault(a => a.Name == $"{name}UpdateInput");
var detail = dtos.FirstOrDefault(a => a.Name == $"{name}DetailOutput");
var permission = dtos.FirstOrDefault(a => a.Name == $"{name}Permissions");
string? permissionGroup = permission?.GetField("GroupName")?.GetValue(null)?.ToString();
list.Add(new TemplateVueModel(name, displayName, new TemplateVueModelType()
{
SearchType = search,
PageType = page,
DetailType = detail,
CreateType = create,
UpdateType = update,
}, permissionGroup));
}
//开始生成
await _codeGeneratorStore.StartAsync(list, CodeGeneratorRemoteServiceConsts.RootPath, "E:\\MY\\Rong.CodeGenerator\\vue\\vben_demo");
return Content("ok");
}}
}
4. 页面位置和命名
1.生成的页面文件在 src/views/ 下,以“小驼峰实体名”为文件夹名:
新增页:add.vue
修改页:modify.vue
主页:index.vue
详情页:detail.vue
详情弹框页: detailDrawer.vue
api接口:api.ts
2.路由: 在src/router/routes/modules/ 下,以“小驼峰实体名”命名:
xxx.ts
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Volo.Abp.TextTemplating.Razor (>= 8.1.4)
-
.NETStandard 2.1
- Volo.Abp.TextTemplating.Razor (>= 8.1.4)
-
net7.0
- Volo.Abp.TextTemplating.Razor (>= 8.1.4)
-
net8.0
- Volo.Abp.TextTemplating.Razor (>= 8.1.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
8.2.2 | 117 | 9/3/2024 | |
8.2.1 | 125 | 8/15/2024 | |
8.2.0 | 127 | 8/6/2024 | |
8.1.2 | 108 | 9/3/2024 | |
8.1.1 | 128 | 8/15/2024 | |
8.1.0 | 104 | 8/6/2024 | |
8.0.2 | 116 | 9/3/2024 | |
8.0.1 | 121 | 8/15/2024 | |
8.0.0 | 100 | 8/6/2024 | |
7.4.2 | 99 | 9/3/2024 | |
7.4.1 | 131 | 8/15/2024 | |
7.4.0 | 100 | 8/6/2024 | |
7.3.2 | 105 | 9/3/2024 | |
7.3.1 | 121 | 8/15/2024 | |
7.3.0 | 98 | 8/6/2024 | |
7.2.2 | 106 | 9/3/2024 | |
7.2.1 | 122 | 8/15/2024 | |
7.2.0 | 104 | 8/6/2024 | |
7.1.2 | 109 | 9/3/2024 | |
7.1.1 | 128 | 8/15/2024 | |
7.1.0 | 104 | 8/6/2024 | |
7.0.2 | 110 | 9/3/2024 | |
7.0.1 | 130 | 8/15/2024 | |
7.0.0 | 102 | 8/6/2024 | |
6.0.2 | 107 | 9/3/2024 | |
6.0.1 | 117 | 8/15/2024 | |
6.0.0 | 105 | 8/6/2024 | |
5.3.2 | 103 | 9/3/2024 | |
5.3.1 | 124 | 8/15/2024 | |
5.3.0 | 102 | 8/6/2024 | |
5.2.2 | 107 | 9/3/2024 | |
5.2.1 | 126 | 8/15/2024 | |
5.2.0 | 102 | 8/6/2024 | |
5.1.2 | 100 | 9/3/2024 | |
5.1.1 | 132 | 8/15/2024 | |
5.1.0 | 97 | 8/6/2024 | |
5.0.2 | 116 | 9/3/2024 | |
5.0.1 | 133 | 8/15/2024 | |
5.0.0 | 99 | 8/6/2024 | |
0.3.20 | 92 | 8/3/2024 | |
0.3.19 | 85 | 8/3/2024 | |
0.3.18 | 86 | 8/3/2024 | |
0.3.17 | 73 | 7/31/2024 | |
0.3.15 | 98 | 7/25/2024 | |
0.3.14 | 98 | 7/25/2024 | |
0.3.13 | 84 | 7/25/2024 | |
0.3.12 | 87 | 7/25/2024 | |
0.3.11 | 93 | 7/25/2024 | |
0.3.10 | 119 | 7/24/2024 | |
0.3.9 | 104 | 7/24/2024 | |
0.3.8 | 123 | 7/23/2024 | |
0.3.7 | 123 | 7/23/2024 | |
0.3.6 | 118 | 7/23/2024 | |
0.3.5 | 123 | 7/22/2024 | |
0.3.4 | 117 | 7/22/2024 | |
0.3.3 | 136 | 7/22/2024 | |
0.3.2 | 113 | 7/18/2024 | |
0.3.1 | 109 | 7/16/2024 | |
0.3.0 | 114 | 7/9/2024 | |
0.2.6 | 113 | 7/4/2024 | |
0.2.5 | 114 | 7/3/2024 | |
0.2.4 | 121 | 6/28/2024 | |
0.2.3 | 116 | 6/28/2024 |