Javascript Vue 3组件渲染不适用于Google应用程序脚本

Javascript Vue 3组件渲染不适用于Google应用程序脚本,javascript,vue.js,google-apps-script,vuejs2,vuejs3,Javascript,Vue.js,Google Apps Script,Vuejs2,Vuejs3,我从Vue和Vue 3开始,在Google Apps脚本上编写一个应用程序 我正在学习Vue精通教程,我还发现了@brucemcpherson提供的Vue 2应用程序在GAS上运行的惊人示例,但有些部分对我来说太难理解 GitHub: 不知怎的,GAS和Vue在处理组件时有些棘手,我需要一些帮助 这是我的文件: index.html <!DOCTYPE html> <html> <head> </head> <body>

我从Vue和Vue 3开始,在Google Apps脚本上编写一个应用程序

我正在学习Vue精通教程,我还发现了@brucemcpherson提供的Vue 2应用程序在GAS上运行的惊人示例,但有些部分对我来说太难理解

GitHub:

不知怎的,GAS和Vue在处理组件时有些棘手,我需要一些帮助

这是我的文件:

index.html

<!DOCTYPE html>
<html>
  <head>
  </head>
  <body>
    <div id="app">
      <h1>{{ product }}</h1>
      </my-component></my-component>
    </div>
    <script src="https://unpkg.com/vue@3.0.0-beta.12/dist/vue.global.js"></script>
    <?!= include("main-js"); ?>
    <?!= include("my-component"); ?>
    <script>
      const mountedApp = app.mount('#app')
    </script>
  </body>
</html>
<script>
  const app = Vue.createApp({
      data() {
          return {
              product: 'Socks'
          }
      }
  })
</script>
<script>
  app.component('my-component', {
    template: `<div>My component content</div>`,
    data() {
          return {
              product: 'Boots'
          }
      }
  })
</script>
main js.html

<!DOCTYPE html>
<html>
  <head>
  </head>
  <body>
    <div id="app">
      <h1>{{ product }}</h1>
      </my-component></my-component>
    </div>
    <script src="https://unpkg.com/vue@3.0.0-beta.12/dist/vue.global.js"></script>
    <?!= include("main-js"); ?>
    <?!= include("my-component"); ?>
    <script>
      const mountedApp = app.mount('#app')
    </script>
  </body>
</html>
<script>
  const app = Vue.createApp({
      data() {
          return {
              product: 'Socks'
          }
      }
  })
</script>
<script>
  app.component('my-component', {
    template: `<div>My component content</div>`,
    data() {
          return {
              product: 'Boots'
          }
      }
  })
</script>
这两种情况都没有发生:index.html充电时,我看不到我的组件


你知道有什么问题吗?谢谢

您必须首先启动vue,然后安装应用程序。不确定这是否是你的问题,但这里有一个工作代码笔。另外,我已经在中导入了vue库


{{product}}
//创建vue实例
const app=Vue.createApp({
数据(){
返回{
产品:"袜子",,
}
}
});
//添加组件
应用程序组件(“我的组件”{
模板:`
我的组件内容{{product}
`,
数据(){
返回{
产品:“靴子”
}
}
})
//装上它
const mountedApp=app.mount(“#app”)

谢谢您的快速回复,@tzknc。我不确定问题出在哪里,但你的代码在谷歌应用程序脚本上表现得非常出色。我的真实案例包括导入Vuetify,但有些情况下我无法成功使用Vue on GAS将Vuetify css包括在内。因为它包含了标签上的接缝,它对我不起作用。。。但也许这应该是第二个问题。非常感谢。我刚刚读到Vuetify 2x与Vue 3不兼容。。。