Skip to content

san fragment 标签 ssr 反解问题 #98

@zhuguoxi

Description

@zhuguoxi
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
</head>

<body>
    <div id="root">
        <!--s-frag-->
        <div>123</div>
        <!--/s-frag-->
    </div>
    <script src="https://unpkg.com/san@latest"></script>
    <script>
    var MyApp = san.defineComponent({
    computed: {
        name: function () {
            const f = this.data.get('firstName')
            const l = this.data.get('lastName')
            return `${f} ${l}`
        }
    },
    template: `<fragment>
        <div>123</div>
        </fragment>
    `
});
    var myApp = new MyApp({el: document.getElementById('root').firstElementChild});
    myApp.attach(document.getElementById('root'));
    </script>
</body>
</html>

错误信息:

san@latest:1 Uncaught Error: [SAN REVERSE ERROR] Element not found. 
Paths: component[root] > div
    at new le (san@latest:1)
    at me (san@latest:1)
    at ye (san@latest:1)
    at i.Ue (san@latest:1)
    at new i (san@latest:1)
    at (index):29

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions