Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AddVueComponent = command.InlineHandler[*VueComponentConfig](func(c *cli.Context, config *VueComponentConfig) error { filename := strcase.ToCamel(config.Name) kebabName := strcase.ToKebab(config.Name) outDir := config.OutDir if config.Isolated { filename = "index" outDir = path.Join(config.OutDir, kebabName) } b := new(bytes.Buffer) if err := task.NewSequentialScheduler(). AddTask(task.NewReadFromProviderTask(provider.NewEmbedFileProvider("templates/vue/vue_component.go.tmpl"), b)). AddTask(task.NewTemplateRenderTask("vue_component", nil, b, b)). AddTask(task.NewWriteFileToDiskTask(filename, ".vue", b, task.WithFolder(outDir))). Run(); err != nil { return err } return nil })
View Source
var AddVueDirective = command.InlineHandler[*VueDirectiveConfig](func(c *cli.Context, config *VueDirectiveConfig) error { filename := config.Name camelName := strcase.ToCamel(filename) outDir := config.OutDir if config.Isolated { outDir = path.Join(config.OutDir, filename) filename = "index" } b := new(bytes.Buffer) if err := task.NewSequentialScheduler(). AddTask(task.NewReadFromProviderTask(provider.NewEmbedFileProvider("templates/vue/vue_directive.go.tmpl"), b)). AddTask(task.NewTemplateRenderTask("vue_directive", map[string]string{ "name": camelName, }, b, b)). AddTask(task.NewWriteFileToDiskTask(filename, ".ts", b, task.WithFolder(outDir))). Run(); err != nil { return err } return nil })
View Source
var CommandSet = &cli.Command{ Name: "vue", Aliases: []string{"v"}, Usage: "vue 工具套件", Subcommands: []*cli.Command{ VueUseStoreCmd, VueComponentCmd, VueDirectiveCmd, }, }
View Source
var UseVueStore = command.InlineHandler[*VueUseStoreConfig](func(c *cli.Context, config *VueUseStoreConfig) error { name := strcase.ToCamel(config.Name) storeKey := strcase.ToKebab(config.Name) filename := fmt.Sprintf("use%sStore", name) b := new(bytes.Buffer) if err := task.NewSequentialScheduler(). AddTask(task.NewReadFromProviderTask(provider.NewEmbedFileProvider("templates/vue/vue_use_store.go.tmpl"), b)). AddTask(task.NewTemplateRenderTask("vue_use_store", map[string]string{"storeKey": storeKey, "name": name}, b, b)). AddTask(task.NewWriteFileToDiskTask(filename, ".ts", b, task.WithFolder(config.OutDir))). Run(); err != nil { return err } return nil })
View Source
var VueComponentCmd = command.NewCommand("component", "add vue component", new(VueComponentConfig), command.WithAlias([]string{"c"}), ).AddHandler( AddVueComponent, ).Create()
View Source
var VueDirectiveCmd = command.NewCommand("directive", "add vue directive", new(VueDirectiveConfig), command.WithAlias([]string{"d"}), ).AddHandler( AddVueDirective, ).Create()
View Source
var VueUseStoreCmd = command.NewCommand("store", "add vue pinia store", new(VueUseStoreConfig), command.WithAlias([]string{"s"}), ).AddHandler( UseVueStore, ).Create()
Functions ¶
This section is empty.
Types ¶
type VueComponentConfig ¶
type VueDirectiveConfig ¶
type VueUseStoreConfig ¶
Click to show internal directories.
Click to hide internal directories.