// my-component.js // 引入全局 Vue 对象(因在 HTML 中通过 script 引入,Vue 已挂载到 window) const { defineComponent } = Vue; import { itemBottom } from "../item-bottom/item-bottom.js"; import { itemHead } from "../item-head/item-head.js"; // 定义组件(直接使用模板) export const itemForum = defineComponent({ name: "item-forum", props: { title: { type: String, default: "默认标题", }, }, // 方法 methods: { handleClick() { alert("组件按钮被点击"); }, }, components: { itemBottom, itemHead, }, template: `