30 lines
1.3 KiB
JavaScript
30 lines
1.3 KiB
JavaScript
// 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: `<div class="item-box item-forum"> <item-head></item-head> <div class="label flexflex"> <img class="item icon" src="./img/recommend-icon.png" /> <img class="item icon" src="./img/essence-icon.png" /> <div class="item blue">香港</div> <div class="item">香港</div> </div> <div class="title">【干货】香港留学费用准备</div> <div class="message">在即将赴港的时候,很多同学好奇香港一年制硕士下来的整体费用大概是多少,其实主要包括学费,租房费和生活费三部分。学费的话根据不同香港来定,大概在10-30万港币之间,比较固定…</div> <item-bottom></item-bottom></div>`,
|
||
});
|