提交 992a07bd 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

fix a issue

上级 f364d13d
......@@ -100,6 +100,7 @@ type DefInfo struct {
Title string `yaml:"title"`
Desc string `yaml:"desc"`
Fields interface{} `yaml:"fields,omitempty"` // is yaml
Range string `yaml:"range,omitempty"` // is config
Ranges interface{} `yaml:"ranges,omitempty"` // is ranges
Instances interface{} `yaml:"instances,omitempty"` // is instances
......
......@@ -73,8 +73,7 @@ func LoadRes(resType string) (res map[string][]model.ResFile, nameWidth, titleWi
}
}
if resType == "" || resType == item.ResType ||
(resType == "yaml" && fileExt == ".yaml"){
if resType == "" || resType == item.ResType {
arr = append(arr, item)
}
}
......@@ -236,6 +235,8 @@ func GetYamlResType(def model.DefInfo) string {
return constant.ResTypeRanges
} else if def.Instances != nil {
return constant.ResTypeInstances
} else if def.Fields != nil {
return constant.ResTypeYaml
}
return ""
......
......@@ -71,6 +71,7 @@ var (
ResTypeConfig = "config"
ResTypeRanges = "ranges"
ResTypeInstances = "instances"
ResTypeYaml = "yaml"
ResTypeExcel = "excel"
ResTypeText = "text"
ResTypes = []string{ResTypeConfig, ResTypeRanges, ResTypeInstances, ResTypeExcel, ResTypeText}
......
......@@ -66,6 +66,10 @@ func BoolToPass(b bool) string {
}
}
func FindInArrBool(str string, arr []string) bool {
found, _ := FindInArr(str, arr)
return found
}
func FindInArr(str string, arr []string) (bool,int) {
for index, s := range arr {
if str == s {
......@@ -240,4 +244,4 @@ func UrlEncode(str string) (ret string) {
ret = base64.URLEncoding.EncodeToString([]byte(str))
return
}
\ No newline at end of file
}
......@@ -136,7 +136,7 @@ export default {
},
onReferChanged(value) {
console.log("onReferChanged")
this.refer.file = value
this.refer.file = value.split('-')[0]
if (this.refer.type != 'yaml' && this.refer.type != 'text') {
this.listDefFieldReferField()
......
title: YAML类型
desc:
author:
version: 1.0
fields:
- field: t1
range: a-z
postfix: "\t"
- field: WC_SEX
range: sex.txt
#rand: true
postfix: "\t"
- field: t2
range: 1-9
postfix: "\t"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册