随笔分类 -  微信小程序 - 开发

上一页 1 ··· 88 89 90 91 92 93 94 95 96 ··· 107 下一页
变量
摘要:变量 概念 WXS 中的变量均为值的引用。 没有声明的变量直接赋值使用,会被定义为全局变量。 如果只声明变量而不赋值,则默认值为 undefined。 var表现与javascript一致,会有变量提升。 var foo = 1; var bar = "hello world"; var i; // 阅读全文
posted @ 2024-12-29 17:52 AtlasLapetos 阅读(15) 评论(0) 推荐(0)
WXS 模块
摘要:WXS 模块 WXS 代码可以编写在 wxml 文件中的 <wxs> 标签内,或以 .wxs 为后缀名的文件内。 模块 每一个 .wxs 文件和 <wxs> 标签都是一个单独的模块。 每个模块都有自己独立的作用域。即在一个模块里面定义的变量与函数,默认为私有的,对其他模块不可见。 一个模块要想对外暴 阅读全文
posted @ 2024-12-29 17:51 AtlasLapetos 阅读(17) 评论(0) 推荐(0)
WXS 语法参考
摘要:WXS 语法参考 WXS(WeiXin Script)是小程序的一套脚本语言,结合 WXML,可以构建出页面的结构。 WXS 与 JavaScript 是不同的语言,有自己的语法,并不和 JavaScript 一致。 WXS 模块 变量 注释 运算符 语句 数据类型 基础类库 阅读全文
posted @ 2024-12-29 17:51 AtlasLapetos 阅读(9) 评论(0) 推荐(0)
引用
摘要:引用 WXML 提供两种文件引用方式import和include。 import import可以在该文件中使用目标文件定义的template,如: 在 item.wxml 中定义了一个叫item的template: <!-- item.wxml --> <template name="item"> 阅读全文
posted @ 2024-12-29 17:51 AtlasLapetos 阅读(6) 评论(0) 推荐(0)
模板
摘要:模板 WXML提供模板(template),可以在模板中定义代码片段,然后在不同的地方调用。 定义模板 使用 name 属性,作为模板的名字。然后在<template/>内定义代码片段,如: <!-- index: int msg: string time: string --> <template 阅读全文
posted @ 2024-12-29 17:51 AtlasLapetos 阅读(21) 评论(0) 推荐(0)
条件渲染
摘要:条件渲染 wx:if 在框架中,使用 wx:if="" 来判断是否需要渲染该代码块: <view wx:if="{{condition}}"> True </view> 也可以用 wx:elif 和 wx:else 来添加一个 else 块: <view wx:if="{{length > 5}}" 阅读全文
posted @ 2024-12-29 17:51 AtlasLapetos 阅读(6) 评论(0) 推荐(0)
列表渲染
摘要:列表渲染 wx:for 在组件上使用 wx:for 控制属性绑定一个数组,即可使用数组中各项的数据重复渲染该组件。 默认数组的当前项的下标变量名默认为 index,数组当前项的变量名默认为 item <view wx:for="{{array}}"> {{index}}: {{item.messag 阅读全文
posted @ 2024-12-29 17:51 AtlasLapetos 阅读(13) 评论(0) 推荐(0)
数据绑定
摘要:数据绑定 WXML 中的动态数据均来自对应 Page 的 data。 简单绑定 数据绑定使用 Mustache 语法(双大括号)将变量包起来,可以作用于: 内容 <view> {{ message }} </view> Page({ data: { message: 'Hello MINA!' } 阅读全文
posted @ 2024-12-29 17:51 AtlasLapetos 阅读(6) 评论(0) 推荐(0)
WXML
摘要:WXML WXML(WeiXin Markup Language)是框架设计的一套标签语言,结合基础组件、事件系统,可以构建出页面的结构。 用以下一些简单的例子来看看 WXML 具有什么能力: 数据绑定 <!--wxml--> <view> {{message}} </view> // page.j 阅读全文
posted @ 2024-12-29 17:50 AtlasLapetos 阅读(7) 评论(0) 推荐(0)
clearInterval
摘要:clearInterval(number intervalID) 以 Promise 风格 调用:不支持 小程序插件:支持 取消由 setInterval 设置的定时器。 参数 number intervalID 要取消的定时器的 ID 阅读全文
posted @ 2024-12-29 17:50 AtlasLapetos 阅读(7) 评论(0) 推荐(0)
setInterval
摘要:number setInterval(function callback, number delay, any rest) 以 Promise 风格 调用:不支持 小程序插件:支持 设定一个定时器。按照指定的周期(以毫秒计)来执行注册的回调函数 参数 function callback 回调函数 n 阅读全文
posted @ 2024-12-29 17:50 AtlasLapetos 阅读(13) 评论(0) 推荐(0)
clearTimeout
摘要:clearTimeout(number timeoutID) 以 Promise 风格 调用:不支持 小程序插件:支持 取消由 setTimeout 设置的定时器。 参数 number timeoutID 要取消的定时器的 ID 阅读全文
posted @ 2024-12-29 17:50 AtlasLapetos 阅读(10) 评论(0) 推荐(0)
setTimeout
摘要:number setTimeout(function callback, number delay, any rest) 以 Promise 风格 调用:不支持 小程序插件:支持 设定一个定时器。在定时到期以后执行注册的回调函数 参数 function callback 回调函数 number de 阅读全文
posted @ 2024-12-29 17:50 AtlasLapetos 阅读(15) 评论(0) 推荐(0)
console.warn
摘要:console.warn() 向调试面板中打印 warn 日志 参数 any ...args 日志内容,可以有任意多个。 阅读全文
posted @ 2024-12-29 17:50 AtlasLapetos 阅读(7) 评论(0) 推荐(0)
console.log
摘要:console.log() 向调试面板中打印 log 日志 参数 any ...args 日志内容,可以有任意多个。 阅读全文
posted @ 2024-12-29 17:50 AtlasLapetos 阅读(5) 评论(0) 推荐(0)
console.info
摘要:console.info() 向调试面板中打印 info 日志 参数 any ...args 日志内容,可以有任意多个。 阅读全文
posted @ 2024-12-29 17:50 AtlasLapetos 阅读(4) 评论(0) 推荐(0)
console.groupEnd
摘要:console.groupEnd() 结束由 console.group 创建的分组 注意事项 仅在工具中有效,在 vConsole 中为空函数实现。 阅读全文
posted @ 2024-12-29 17:50 AtlasLapetos 阅读(4) 评论(0) 推荐(0)
console.group
摘要:console.group(string label) 在调试面板中创建一个新的分组。随后输出的内容都会被添加一个缩进,表示该内容属于当前分组。调用 console.groupEnd之后分组结束。 参数 string label 分组标记,可选。 注意事项 仅在工具中有效,在 vConsole 中为 阅读全文
posted @ 2024-12-29 17:50 AtlasLapetos 阅读(9) 评论(0) 推荐(0)
console.error
摘要:console.error() 向调试面板中打印 error 日志 参数 any ...args 日志内容,可以有任意多个。 阅读全文
posted @ 2024-12-29 17:50 AtlasLapetos 阅读(5) 评论(0) 推荐(0)
console.debug
摘要:console.debug() 向调试面板中打印 debug 日志 参数 any ...args 日志内容,可以有任意多个。 阅读全文
posted @ 2024-12-29 17:49 AtlasLapetos 阅读(7) 评论(0) 推荐(0)

上一页 1 ··· 88 89 90 91 92 93 94 95 96 ··· 107 下一页