1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-06-04 21:27:34 +08:00
parent f0e799c970
commit b3f1fefedf
10 changed files with 125 additions and 19 deletions

View File

@ -21,6 +21,10 @@ func _field_show(m *ice.Message, name, text string, arg ...string) {
kit.For(arg, func(k, v string) { kit.For(arg, func(k, v string) {
if k == ctx.ARGS { if k == ctx.ARGS {
kit.Value(meta, k, kit.Split(strings.TrimSuffix(strings.TrimPrefix(v, "["), "]"))) kit.Value(meta, k, kit.Split(strings.TrimSuffix(strings.TrimPrefix(v, "["), "]")))
} else if k == ice.MSG_RESULT {
m.Option("output", strings.TrimSpace(v))
kit.Value(meta, "meta.mode", "result")
kit.Value(meta, "msg", kit.Dict())
} else { } else {
kit.Value(meta, k, v) kit.Value(meta, k, v)
} }
@ -34,8 +38,11 @@ const FIELD = "field"
func init() { func init() {
Index.MergeCommands(ice.Commands{ Index.MergeCommands(ice.Commands{
FIELD: {Name: "field name cmd", Help: "插件", Actions: ctx.CmdAction(), Hand: func(m *ice.Message, arg ...string) { FIELD: {Name: "field name cmd", Help: "插件", Actions: ctx.CmdAction(), Hand: func(m *ice.Message, arg ...string) {
kit.If(kit.Select("", arg, 1) == ctx.ARGS, func() { arg = kit.Simple("", arg) }) kit.If(kit.IsIn(kit.Select("", arg, 1), ctx.ARGS, ice.MSG_RESULT), func() { arg = kit.Simple("", arg) })
arg = _name(m, arg) arg = _name(m, arg)
if arg[0] == "inner" {
arg = append([]string{"", "web.code.inner", "args", "src/ main.go", "result", arg[1], "meta.display", "/plugin/local/code/inner.js", "style", "output"}, arg[2:]...)
}
_field_show(m, arg[0], arg[1], arg[2:]...) _field_show(m, arg[0], arg[1], arg[2:]...)
}}, }},
}) })

View File

@ -12,3 +12,4 @@ shell `
git clone -b imooc-island https://gitee.com/talelin/lin-cms-vue.git git clone -b imooc-island https://gitee.com/talelin/lin-cms-vue.git
git clone -b imooc-island https://gitee.com/talelin/lin-cms-koa.git git clone -b imooc-island https://gitee.com/talelin/lin-cms-koa.git
` `
field web.code.vimer args "usr/lin-cms-vue/ src/views/home/Home.vue"

28
misc/node/api.go Normal file
View File

@ -0,0 +1,28 @@
package node
import (
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/web"
)
type api struct {
spaceList string `http:"/api/space/list"`
userList string `http:"/api/user/list"`
userAdd string `http:"/api/user/add"`
}
func (s api) UserAdd(m *ice.Message, arg ...string) {
m.Cmdy(aaa.USER)
}
func (s api) UserList(m *ice.Message, arg ...string) {
m.Cmdy(aaa.USER)
}
func (s api) SpaceList(m *ice.Message, arg ...string) {
m.Cmdy(web.DREAM)
}
func (s api) List() {
}
func init() { ice.CodeCtxCmd(api{}) }

View File

@ -1,5 +0,0 @@
section "element"
refer `
https://element.eleme.cn/2.0/#/zh-CN/component/installation
`

View File

@ -1,7 +0,0 @@
section "grpc"
shell `
cnpm i --save-dev grpc-web
cnpm i --save-dev google-protobuf
cnpm i -g protoc-gen-js protoc-gen-grpc-web
protoc --js_out=import_style=commonjs:./demo/src --grpc-web_out=import_style=commonjs,mode=grpcwebtext:./demo/src ./idl/*.proto
`

View File

@ -4,6 +4,7 @@ refer `
官网 https://nodejs.org/ 官网 https://nodejs.org/
源码 https://github.com/nodejs/node 源码 https://github.com/nodejs/node
文档 https://nodejs.org/dist/latest-v18.x/docs/api/ 文档 https://nodejs.org/dist/latest-v18.x/docs/api/
https://cloud.tencent.com/developer/section/1489885
` `
field web.code.node.node field web.code.node.node

View File

@ -3,3 +3,4 @@ shell `
./bin/npm install -g cnpm --registry=https://registry.npm.taobao.org ./bin/npm install -g cnpm --registry=https://registry.npm.taobao.org
` `
field web.code.node.npm field web.code.node.npm

View File

@ -1,4 +0,0 @@
section "router"
refer `
https://router.vuejs.org/zh/guide/essentials/nested-routes.html
`

View File

@ -3,15 +3,63 @@ package node
import ( import (
"shylinux.com/x/ice" "shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/nfs" "shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/tcp"
"shylinux.com/x/icebergs/core/code"
kit "shylinux.com/x/toolkits"
) )
type vue struct { type vue struct {
ice.Code ice.Code
ice.Lang
list string `name:"list path auto" help:"框架"` list string `name:"list path auto" help:"框架"`
} }
func (s vue) List(m *ice.Message) { func (s vue) Render(m *ice.Message, arg ...string) {
m.Cmdy(nfs.DIR, nfs.USR) list := kit.Dict(kit.UnMarshal(m.Cmdx(nfs.CAT, kit.Path(m.Option(nfs.PATH), "display.json"))))
m.EchoIFrame(kit.Format("%s%s", list[tcp.HOST], kit.Format(list[m.Option(nfs.FILE)])))
} }
func (s vue) Init(m *ice.Message) {
s.Lang.Init(m, code.PREPARE, ice.Map{
code.KEYWORD: kit.List(
"template", "script", "style",
"router-link", "router-view",
"el-container", "el-aside", "el-header", "el-main",
"el-tabs",
"el-tab-pane",
"el-dialog",
"el-form",
"el-form-item",
"el-input",
"el-select",
"el-option",
"el-button",
"el-checkbox-group",
"el-checkbox",
"el-pagination",
"el-menu",
"el-submenu",
"el-menu-item",
"el-table",
"el-table-column",
),
code.FUNCTION: kit.List(
"data",
"props",
"inject",
"provide",
"components",
"computed",
"created",
"mounted",
"methods",
"watch",
),
}, "include", kit.List(nfs.HTML, nfs.CSS, nfs.JS), "split.operator", "{[(.,:</>#)]}")
}
func (s vue) List(m *ice.Message) { m.Cmdy(nfs.DIR, nfs.USR) }
func init() { ice.CodeCtxCmd(vue{}) } func init() { ice.CodeCtxCmd(vue{}) }

View File

@ -9,4 +9,40 @@ shell `
cnpm install -g @vue/cli cnpm install -g @vue/cli
vue create demo && cd demo vue create demo && cd demo
vue serve vue serve
vue build
`
section "grpc"
shell `
cnpm i --save-dev grpc-web
cnpm i --save-dev google-protobuf
cnpm i -g protoc-gen-js protoc-gen-grpc-web
protoc --js_out=import_style=commonjs:./demo/src --grpc-web_out=import_style=commonjs,mode=grpcwebtext:./demo/src ./idl/*.proto
`
section "axios"
refer `
官网 https://www.axios-http.cn
文档 https://www.axios-http.cn/docs/intro
源码 https://github.com/axios/axios
`
section "router"
refer `
https://router.vuejs.org/zh/guide/essentials/nested-routes.html
`
section "element"
refer `
https://element.eleme.cn/2.0/#/zh-CN/component/installation
`
shell `
npm install element-ui
`
field inner `
// main.js
import ElementUI from "element-ui"
Vue.use(ElementUI)
` `