【问题标题】:Can not get .vue single file components to work with NWjs无法让 .vue 单文件组件与 NWjs 一起使用
【发布时间】:2019-02-18 17:33:13
【问题描述】:

下午好,我正在使用 0.26.1 版本的 NWjs 制作桌面应用程序我正在使用带有 XfCE4 的 Ubuntu 服务器 16.04 来开发我想使用 Vue.JS 作为数据部分并使用 buefy 作为其 UI 组件的应用程序。但由于这个 UI Vue 框架使用单个文件 .vue 文件组件,我面临这个错误

Uncaught SyntaxError: Unexpected token <
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:600:28)
at Object.Module._extensions..js (module.js:653:10)
at Module.load (module.js:555:32)
at tryModuleLoad (module.js:518:12)
at Function.Module._load (module.js:510:3)
at Module.require (module.js:580:17)
at require (internal/module.js:11:18)
at self.require (<anonymous>:11:26)

我已经能够使用 webpack 生成一个 bundle js 文件没有问题,但是 NWjs 坚持解析单个文件组件中的 HTML 标签。

样机组件如下

 <template>
    <section>
    <span>
    <b-field>
        <b-switch v-model="bars">Bars</b-switch>
    </b-field>
    <b-datepicker inline v-model="date" :events="events" indicators="indicators">
    </b-datepicker>
    </span>
  </section>
</template>

<script>
export default {

}
</script>
<style lang="sass" scoped>
</style>

任何关于这方面的信息都会有非常宝贵的帮助,在此先感谢。

【问题讨论】:

  • 删除&lt;style &lt;style lang="sass" scoped&gt; 中的&lt;style 我认为它会导致问题
  • 对不起,这是我粘贴代码时的拼写错误。原版在 django 应用程序中运行良好。已编辑。

标签: vuejs2 vue-component buefy


【解决方案1】:

使用 Vue-cli 和 vue init 解决。

【讨论】:

    猜你喜欢
    • 2017-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-05
    相关资源
    最近更新 更多