mirror of
https://gitee.com/energye/energy.git
synced 2024-12-04 12:47:57 +08:00
upgrade-dev v2.3.41
This commit is contained in:
parent
7e3d6d14a1
commit
3f6cd0c575
@ -110,6 +110,10 @@ func Test() {
|
||||
inArgument.Add("字符串参数")
|
||||
funcKey.Invoke(inArgument)
|
||||
|
||||
funcKey.SetValue("函数变字符串")
|
||||
funcToString := funcKey.AsString()
|
||||
fmt.Println("funcToString:", funcToString.Value())
|
||||
|
||||
// 对象
|
||||
type objectDemo1 struct {
|
||||
Key1 string
|
||||
@ -162,8 +166,16 @@ func Test() {
|
||||
objectKey8 := objectKey.Get("Key8")
|
||||
fmt.Println("objectKey8:", objectKey8.JSONString())
|
||||
objectKey8.AsArray()
|
||||
//end
|
||||
//object end
|
||||
fmt.Println("objectKey:", objectKey.JSONString())
|
||||
//object to string
|
||||
objectKey.SetValue("对象变成字符串")
|
||||
objectToString := objectKey.AsString()
|
||||
fmt.Println("objectToString:", objectToString.Value())
|
||||
fmt.Println("objectKey:", objectKey.JSONString())
|
||||
objectKey.SetValue(testObj)
|
||||
fmt.Println("objectKey:", objectKey.JSONString())
|
||||
|
||||
// 数组
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,6 @@ func (m *V8Value) JSONString() string {
|
||||
}
|
||||
|
||||
// SetValue 设置值
|
||||
// 函数不能设置值
|
||||
func (m *V8Value) SetValue(value any) {
|
||||
if isMainProcess {
|
||||
rv := reflect.ValueOf(value)
|
||||
@ -115,10 +114,15 @@ func (m *V8Value) SetValue(value any) {
|
||||
case reflect.Func:
|
||||
m.value = &json.JsonData{T: consts.GO_VALUE_FUNC, V: value, S: 0}
|
||||
default:
|
||||
//基本类型
|
||||
m.value.SetValue(value)
|
||||
m.rv = nil
|
||||
return
|
||||
}
|
||||
if m.rv != nil {
|
||||
m.rv.Set(rv)
|
||||
} else {
|
||||
m.rv = &rv
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user