当前位置:网站首页>微信小程序中 在xwml 中使用外部引入的 js进行判断计算
微信小程序中 在xwml 中使用外部引入的 js进行判断计算
2022-07-02 03:25:00 【今天星期八】
使用 场景
- 同一个页面展示两个数组,在js 中计算数组长度麻烦
- 可在wxml中进行操作
在wxml 中使用 (将其在wxml 文件中引入)

<view class="item-info">
<view class="item-title">业主审核</view>
<wxs src="../../utils/calculate.wxs" module="tools" />
<view class="wait" wx:if="{
{tools.calculate(new_list,new_list_gs)>0}}">待审核: {
{
tools.calculate(new_list,new_list_gs)}}</view>
</view>
创建 后缀为 wxs 的文件
function calculate(str1, str2) {
if (str1) {
return str1.length + str2.length
} else {
return '0'
}
}
module.exports = {
calculate: calculate
}
边栏推荐
猜你喜欢

ThreadLocal详解

Continuous assignment of Verilog procedure

Yan Rong looks at how to formulate a multi cloud strategy in the era of hybrid cloud
![[JVM] detailed description of the process of creating objects](/img/6e/0803b6b63c48337985faae8d5cbe1a.png)
[JVM] detailed description of the process of creating objects

Verilog avoid latch

Screenshot literacy tool download and use

只需简单几步 - 开始玩耍微信小程序

Gradle foundation | customize the plug-in and upload it to jitpack

West digital decided to raise the price of flash memory products immediately after the factory was polluted by materials

Detailed explanation of the difference between Verilog process assignment
随机推荐
Global and Chinese markets for infant care equipment, 2022-2028: Research Report on technology, participants, trends, market size and share
数据传输中的成帧
Discussion on related configuration of thread pool
Large screen visualization from bronze to the advanced king, you only need a "component reuse"!
JDBC details
aaaaaaaaaaaaa
Start a business
Pointer array & array pointer
Verilog 状态机
Yan Rong looks at how to formulate a multi cloud strategy in the era of hybrid cloud
What is the binding path of SAP ui5
Intersection of Venn graph
Qualcomm platform WiFi -- Native crash caused by WiFi
Kubernetes cluster storageclass persistent storage resource core concept and use
ThreadLocal详解
32, 64, 128 bit system
Docker安装canal、mysql进行简单测试与实现redis和mysql缓存一致性
How to establish its own NFT market platform in 2022
高并发场景下缓存处理方案
Generate random numbers that obey normal distribution