// my-component.js // 引入全局 Vue 对象(因在 HTML 中通过 script 引入,Vue 已挂载到 window) const { defineComponent, ref } = Vue; import { itemBottom } from "../item-bottom/item-bottom.js"; import { itemHead } from "../item-head/item-head.js"; // 定义组件(直接使用模板) export const itemTenement = defineComponent({ name: "item-tenement", props: { itemdata: { type: Object, default: () => {}, }, }, setup(props) { let item = ref({ ...props.itemdata }); // item.value.title = "【投41票】" + item.value.title; // res["timestamp"] = util.strtimeago(res.release_at, 4); // const data = res.data; // const option = data.option || []; // res["isvote"] = option.some((item) => item.selected == 1); // const time = util.handleDeadline(data.deadline); // res["time"] = time; // this.setData({ // item: res, // }); return { item }; }, components: { itemBottom, itemHead, }, template: `
三房找一位室友合租,家具设备齐全
{{ item.location || '九龙 > 尖沙咀/佐敦' }}
HK$
{{ item.rent }}
/月
[ 租期{{ item.rentalduration }} ]
`, });