V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  kumoocat  ›  全部回复第 1 页 / 共 1 页
回复总数  15
47 天前
回复了 buynonsense 创建的主题 Vue.js 新手学习 Vue3,遇到一些问题
https://cn.vuejs.org/guide/essentials/reactivity-fundamentals.html#script-setup
文档里有说:
单文件组件 <script setup> 中的顶层的导入、声明的变量和函数可在同一组件的模板中直接使用。你可以理解为模板是在同一作用域内声明的一个 JavaScript 函数——它自然可以访问与它一起声明的所有内容。
58 天前
回复了 RedBeanIce 创建的主题 Go 编程语言 [natsio] 使用入门问题
官方示例有说:
https://natsbyexample.com/examples/messaging/pub-sub/go

There are two circumstances when a published message won’t be delivered to a subscriber:
The subscriber does not have an active connection to the server
...


func TestNats(t *testing.T) {
url := nats.DefaultURL

nc, _ := nats.Connect(url)
defer nc.Drain()

var wg sync.WaitGroup
wg.Add(1)
nc.Subscribe("foo", func(m *nats.Msg) {
defer wg.Done()
fmt.Printf("Msg received on [%s] : %s\n", m.Subject, string(m.Data))
})

nc.Publish("foo", []byte("Hello World"))

wg.Wait()
}
SMS 走的是 SS7 协议,不是 TCP/IP 协议
@skiy Unmarshal 的异常是有的,没有 panic
@BeautifulSoap Java 直接用基础 int 类型也是 0 啊,Go 不用指针就代表不能为 null
2023-02-14 09:45:26 +08:00
回复了 Seanfuck 创建的主题 Go 编程语言 请教下 interface{} 的问题
@Seanfuck
var s any = []any{1}
fmt.Println(s.([]int))

s 指向的是 []any ,不能强制转换为 []int

var m any
_ = json.Unmarshal([]byte(`{"k":"v"}`), &m)
fmt.Println(m)

m 是 map ,不能强制转换为结构体
2023-01-07 00:22:31 +08:00
回复了 lyonbrown4ddd 创建的主题 Go 编程语言 go 封装随机数生成
```golang
package main

import (
"fmt"
"math/rand"
"time"

"golang.org/x/exp/constraints"
)

func random[T constraints.Integer | constraints.Float](min, max T) T {
rand.Seed(time.Now().UnixNano())
return T(rand.Intn(int(max-min))) + min
}

func main() {
fmt.Println(random(1.14, 5.14))
fmt.Println(random(1, 5))
}
```
2022-12-30 10:40:13 +08:00
回复了 Frankcox 创建的主题 Go 编程语言 Go+Vue.js 如何较好的实现 Web 下载大文件?
io.Copy 每次只写入 32KB 的数据,应该就是楼上说的没有返回 Content-Length 导致客户端计算不出进度
@ibowen 用的是最新的 A01
@ibowen m1 的 air ,我的到手 DP 口只支持 4K 30Hz ,Type-C 没试过,升级了固件又换了根 DP1.4 的线才支持
原本我的 DA305 买回来也是不支持 4K 60Hz ,后来升级下固件就支持了。官网下固件,用 Type c 连上 Windows 的电脑来升级。
2022-07-12 09:24:33 +08:00
回复了 howoldareyou2 创建的主题 Apple 发现 iPhone 上的浏览器后退总是返回上一级顶部?
我是 Ipad 上 Chrome 有这个问题,Iphone 上反而没有
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2875 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 22ms · UTC 09:42 · PVG 17:42 · LAX 02:42 · JFK 05:42
Developed with CodeLauncher
♥ Do have faith in what you're doing.