Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var VoidElements = map[string]bool{ "area": true, "base": true, "br": true, "col": true, "embed": true, "hr": true, "img": true, "input": true, "keygen": true, "link": true, "meta": true, "param": true, "source": true, "track": true, "wbr": true, }
单标签, 在渲染和解析为节点树会使用.
Functions ¶
This section is empty.
Types ¶
type Attributes ¶
type Attributes []Attribute
type Directives ¶
type Directives []Directive
type ElseIf ¶
type ElseIf struct {
Types string // else / elseif
Condition string // elseif语句的condition表达式
VueElement *VueElement
}
type Node ¶
type ParseVueNodeOptions ¶
type VIf ¶
type VueElement ¶
type VueElement struct {
NodeType NodeType
Tag string
Text string
// 是否分配调用组件时传递来的属性.
// 如果组件中只存在一个root节点, 则此节点会自动分配属性. 否则所有root节点都不会.
// (fragments: https://v3.vuejs.org/guide/migration/fragments.html#overview)
DistributionAttr bool
//PropClass *Prop // 动态Class
//PropStyle *Prop // 动态style
Props Props // props, 动态和静态, 包括class和style
VBind *VBind
Directives Directives // 自定义指令, 运行时
//Class Class // 静态class
//Style Styles // 静态style
Children []*VueElement // 子节点
VIf *VIf // 处理v-if需要的数据
VFor *VFor
VSlot *VSlot
VElse bool // 如果是VElse节点则不会生成代码(而是在vif里生成代码)
VElseIf bool
// v-html / v-text
// 支持v-html / v-text指令覆盖子级内容的组件有: template / html基本标签
// component/slot和自定义组件不支持(没有必要)v-html/v-text覆盖子级
VHtml string
VText string
}
func ToVueNode ¶
func ToVueNode(node *Node, options *ParseVueNodeOptions) (vn *VueElement, err error)
将html节点转换为Vue节点
type VueElementParser ¶
type VueElementParser struct {
// contains filtered or unexported fields
}
func (VueElementParser) Parse ¶
func (p VueElementParser) Parse(e *Node) (*VueElement, error)
Click to show internal directories.
Click to hide internal directories.