1

我有以下 .vue 组件文件:

<template>
....

</template>
<script>
export default { /* stuff here*/}
</script>
<style>

</style>

现在我想只为这个组件包含一些css/js(由themeforest上的模板提供)文件。将它们包含在标签中似乎不起作用。知道有什么问题吗?

4

1 回答 1

1

有关如何执行此操作的文档:https ://vue-loader.vuejs.org/en/start/spec.html#src-imports 。

<template src="./template.html"></template>
<style src="./style.css" scoped></style>
<script src="./script.js"></script>

注意scoped属性的使用。也可以使用module属性代替scoped. 更多细节

于 2017-02-17T08:24:23.417 回答