forked from x/icebergs
opt vue
This commit is contained in:
parent
f0e799c970
commit
b3f1fefedf
@ -21,6 +21,10 @@ func _field_show(m *ice.Message, name, text string, arg ...string) {
|
||||
kit.For(arg, func(k, v string) {
|
||||
if k == ctx.ARGS {
|
||||
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 {
|
||||
kit.Value(meta, k, v)
|
||||
}
|
||||
@ -34,8 +38,11 @@ const FIELD = "field"
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
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)
|
||||
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:]...)
|
||||
}},
|
||||
})
|
||||
|
@ -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-koa.git
|
||||
`
|
||||
field web.code.vimer args "usr/lin-cms-vue/ src/views/home/Home.vue"
|
||||
|
28
misc/node/api.go
Normal file
28
misc/node/api.go
Normal 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{}) }
|
@ -1,5 +0,0 @@
|
||||
section "element"
|
||||
refer `
|
||||
https://element.eleme.cn/2.0/#/zh-CN/component/installation
|
||||
`
|
||||
|
@ -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
|
||||
`
|
@ -4,6 +4,7 @@ refer `
|
||||
官网 https://nodejs.org/
|
||||
源码 https://github.com/nodejs/node
|
||||
文档 https://nodejs.org/dist/latest-v18.x/docs/api/
|
||||
https://cloud.tencent.com/developer/section/1489885
|
||||
`
|
||||
|
||||
field web.code.node.node
|
||||
|
@ -3,3 +3,4 @@ shell `
|
||||
./bin/npm install -g cnpm --registry=https://registry.npm.taobao.org
|
||||
`
|
||||
field web.code.node.npm
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
section "router"
|
||||
refer `
|
||||
https://router.vuejs.org/zh/guide/essentials/nested-routes.html
|
||||
`
|
@ -3,15 +3,63 @@ package node
|
||||
import (
|
||||
"shylinux.com/x/ice"
|
||||
"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 {
|
||||
ice.Code
|
||||
ice.Lang
|
||||
list string `name:"list path auto" help:"框架"`
|
||||
}
|
||||
|
||||
func (s vue) List(m *ice.Message) {
|
||||
m.Cmdy(nfs.DIR, nfs.USR)
|
||||
func (s vue) Render(m *ice.Message, arg ...string) {
|
||||
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{}) }
|
||||
|
@ -9,4 +9,40 @@ shell `
|
||||
cnpm install -g @vue/cli
|
||||
vue create demo && cd demo
|
||||
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)
|
||||
`
|
||||
|
Loading…
x
Reference in New Issue
Block a user