惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
罗磊的独立博客
MyScale Blog
MyScale Blog
博客园 - 叶小钗
U
Unit 42
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
有赞技术团队
有赞技术团队
F
Fortinet All Blogs
WordPress大学
WordPress大学
美团技术团队
GbyAI
GbyAI
L
LangChain Blog
T
The Blog of Author Tim Ferriss
P
Proofpoint News Feed
Y
Y Combinator Blog
V
Visual Studio Blog
小众软件
小众软件
D
Docker
量子位
博客园_首页
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Engineering at Meta
Engineering at Meta
N
Netflix TechBlog - Medium
M
MIT News - Artificial intelligence
人人都是产品经理
人人都是产品经理
C
CERT Recently Published Vulnerability Notes
AI
AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Know Your Adversary
Know Your Adversary
Vercel News
Vercel News
C
Check Point Blog
I
InfoQ
NISL@THU
NISL@THU
Webroot Blog
Webroot Blog
S
Security Affairs
Stack Overflow Blog
Stack Overflow Blog
V
Vulnerabilities – Threatpost
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
TaoSecurity Blog
TaoSecurity Blog
L
Lohrmann on Cybersecurity
Hacker News: Ask HN
Hacker News: Ask HN
C
CXSECURITY Database RSS Feed - CXSecurity.com
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
W
WeLiveSecurity
V2EX - 技术
V2EX - 技术
SecWiki News
SecWiki News
PCI Perspectives
PCI Perspectives
S
Secure Thoughts
Apple Machine Learning Research
Apple Machine Learning Research

博客园 - 微宇宙

js-金额相加 小程序- 字符数据换行 antd-输入框去掉光晕 大屏缩放布局 大屏显示 echarts - 原型的方向盘动画 小程序- 自定义导航栏组件封装 小程序-echart动画git仓库 小程序- 隐私协议完善 小程序- 日期picker样式问题 echart - 折线图显示设置 echart - 移动端提示内容无阴影 echart 柱状图 - 零界点 正负方向展示 小程序 - 导航栏 图标设置 小程序 - 错误问题记录 react项目全屏功能 react-大屏显示antd浮窗 React andt库设置主题色彩 React闭包陷阱 git 操作 小程序 - 订阅消息通知 小程序-分包 mysql安装使用 redis安装使用 echart 格式化水平坐标 tooltip数据 小程序-登录验证码的加载方式 工作代码规范 小程序-锚链接 小程序-菜单tabbar设置 小程序-分享功能 小程序-树形结构 array数组 js 小程序-标题自定义设置 小程序-图表 小程序-拨打电话
小程序-模板用法
微宇宙 · 2026-01-20 · via 博客园 - 微宇宙

在一个页面上定义一个片段,然后在不同的地方使用,相比组件更方便一点。

template 使用 name定义别名 ,使用 is 调用模板 别名。

<template name="msgItem">
  <view>
    <text> {{index}}: {{msg}} </text>
    <text> Time: {{time}} </text>
  </view>
</template>
// 使用模板
// 使用 is 属性,声明需要的使用的模板,然后将模板所需要的 data 传入,如:

<template is="msgItem" data="{{...item}}"/>
Page({
  data: {
    item: {
      index: 0,
      msg: 'this is a template',
      time: '2016-09-15'
    }
  }
})