Skip to content

components export的问题 #829

Closed
Closed
@gws321

Description

@gws321

[问题简单描述]

当在.vue文件内export导入的文件为js,js 内 export 时提示 template 'xxx' not found
问题复现步骤:

  1. index.vue
    <template>
    <div>
    <a></a>
    <b></b>
    </div>
    </template>
    <script>
    import {b, c} from './a'
    export default {
    components: {b, c}
    }
    </script>

  2. a/index.js
    import b from './b'
    import c from './c'
    export {
    b, c
    }

  3. a/b.vue
    <template>
    <div>b</div>
    </template>
    <script>
    export default {
    ...
    }
    </script>

  4. a/c.vue
    <template>
    <div>c</div>
    </template>
    <script>
    export default {
    ...
    }
    </script>

npm run dev

VM11791:2 ./a/index$77e68f06.wxml
(anonymous) @ VM11791:2
VM11791:3 Template "index$7e88f077" not found.
2 | <template name="index$77e68f06">
3 | <view class="_div data-v-c964d3c4 container">
> 4 | <template data="{{...$root[$kk+'0'], $root}}" is="index$7e88f077"></template>
| ^
5 | </view>
6 | </template>
(anonymous) @ VM11791:3

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions