摘要: 注册全局组件 注册私有组件 父组件传递值到子组件 父组件传递函数到子组件 阅读全文
posted @ 2019-10-10 22:26 不骄不傲 阅读(2174) 评论(0) 推荐(0) 编辑
摘要: <html> <head> <style> [v-cloak] { /* display: none; */ } </style> </head> <body> <div id="app"> <!--v-cloak解决插入表达式闪烁问题,加载完成后在显示--> <p v-cloak>+++{{msg}}</p> <!-- v-text: 1.默认v-text无闪烁问题 2.v-text会覆盖元素中 阅读全文
posted @ 2019-09-08 22:38 不骄不傲 阅读(248) 评论(0) 推荐(0) 编辑
摘要: 通过比较我们发现string.Builder和bytes.Buffer性能最好 阅读全文
posted @ 2019-08-29 22:57 不骄不傲 阅读(702) 评论(0) 推荐(0) 编辑
摘要: sync.Map详解 sync.Map是1.9才推荐的并发安全的map。 阅读全文
posted @ 2019-08-26 22:45 不骄不傲 阅读(3179) 评论(0) 推荐(0) 编辑
摘要: httprouter httprouter 是一个高性能、可扩展的HTTP路由,上面我们列举的net/http默认路由的不足,都被httprouter 实现,我们先用一个例子,认识下 httprouter 这个强大的 HTTP 路由。 安装: 在这个例子中,首先通过httprouter.New()生 阅读全文
posted @ 2019-08-21 22:50 不骄不傲 阅读(9208) 评论(0) 推荐(1) 编辑
摘要: import ( "sync" "sync/atomic" "testing" ) func TestAtomic(t *testing.T) { /* go语言提供的原子操作都是非侵入式的,它们由标准库代码包sync/atomic中的众多函数代表。 我们调用sync/atomic中的几个函数可以对几种简单的类型进行原子操作。 这些类型包括int3... 阅读全文
posted @ 2019-08-13 22:24 不骄不傲 阅读(400) 评论(0) 推荐(0) 编辑
摘要: import ( "testing" "unsafe" ) type Users struct { Age int32 Name string } func TestUnsafe(t *testing.T) { var user Users var a byte /* func Alignof(x ArbitraryType) uintptr 获取变量以多数字节... 阅读全文
posted @ 2019-08-13 21:47 不骄不傲 阅读(884) 评论(0) 推荐(0) 编辑
摘要: import ( "reflect" "testing" ) type Users struct { ID int Name string } type TestInterface interface { GetName() string } func (u *Users) UpdateName(newName string) { u.Name = newName } fu... 阅读全文
posted @ 2019-08-12 22:32 不骄不傲 阅读(3439) 评论(0) 推荐(0) 编辑
摘要: package main import ( "fmt" "net" "strings" "time" ) type Client struct { C chan string //用于发送数据的管道 Name string //用户名 Address string //IP地址 } //保存在线用户 var onLineMap map[s... 阅读全文
posted @ 2019-01-03 21:56 不骄不傲 阅读(497) 评论(0) 推荐(0) 编辑
摘要: package main import ( "fmt" "io/ioutil" "strings" ) func main() { r1 := strings.NewReader("aaa") //返回ReadCloser对象提供close函数 rc1 := ioutil.NopCloser(r1) defer rc1.Close() //ReadAll读取所有数据 p,... 阅读全文
posted @ 2019-01-03 11:24 不骄不傲 阅读(3159) 评论(0) 推荐(0) 编辑