微信小程序开发中遇到的问题(二):

1、把整个外连接页面显示在小程序中

<web-view src=外连接的网址></web-view>

例:<web-view src="https://www.baidu.com"></web-view>

微信开发者工具中显示结果:

微信小程序开发中遇到的问题(二)

2、<template>中data传值

<template>中不能直接显示{{}}中的值,需要经过<template>中的data传值

例:

js中:

Page({
   data:{
      num:1  
   }
})

wxml中

<template is="temp1" data="{{ ttt:num }}"/> <!--其中ttt为随意定义的变量,将num的值赋给tttt-->

<template name="temp1">
   <view>你好</view>
   <view wx:if="{{ttt==1}}"> <!--用定义的变量来作判断-->
     <template is="temp2"/>
</view>
</template>
<template name="temp2">
   <view>世界</view>
</template>

显示结果:

微信小程序开发中遇到的问题(二)

相关文章:

  • 2023-03-13
  • 2021-12-19
  • 2021-11-07
  • 2021-09-30
  • 2021-04-19
  • 2021-11-17
  • 2021-11-27
猜你喜欢
  • 2022-01-03
  • 2021-11-17
  • 2021-05-20
  • 2021-12-15
  • 2022-12-23
  • 2022-01-12
  • 2021-09-21
相关资源
相似解决方案