鱼C论坛

 找回密码
 立即注册
查看: 4781|回复: 1

微信小程序 WXML调用WXSS 错误!

[复制链接]
发表于 2021-2-20 17:09:44 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
WXML的代码
  1. <!--index.wxml-->

  2. <view class="container">
  3.     <text class="text_style">树莓派客户端</text>
  4. <button  class="con_style" type="primary" bindtap="connectPi">连接</button>
  5. <!-- {{}}是微信小程序的一种语法,里面可以引用变量,因此把原来写死的文字做成变量方便后面改动,因为后面有可能需要点击了开灯按钮,文字信息会变成”关红灯” -->
  6.     <button  class="red_style"  bindtap="redControl">{{redLed}}</button>
  7.     <button  class="green_style"  bindtap="greenControl">{{greenLed}}</button>
  8.     <button  class="blue_style"  bindtap="blueControl">{{blueLed}}</button>
  9.     <button  class="beep_style"  bindtap="beepControl">{{beep}}</button>
  10. </view>
复制代码


WXSS的代码
  1. /**index.wxss**/
  2. /*pages/index/index.wxss */
  3. .text_style{
  4.   color:green;
  5.   font-size:100rpx
  6. }

  7. .con_style{
  8.   width: 210rpx;
  9.   height: 210rpx;
  10.   line-height:210rpx;
  11.   opacity:unset;
  12.   text-align:center;/*为了文字左对齐*/
  13.   padding: 0rpx;/*为了文字左对齐*/
  14.   border-radius: 50%;
  15.   margin-top: 100rpx;
  16.   font-size:60rpx
  17. }


  18. .red_style{
  19.   width:160rpx;  /*宽高一样,因为要做成圆形 */
  20.   height:160rpx;
  21.   margin-left: 60rpx;
  22.   margin-top: -100rpx;
  23.   border-radius: 50%;/*弧度,50%就是圆形了,50~100%之间观察不出来*/
  24.   background-color: red;
  25.   opacity: 1;/*透明度,打开后为1,关闭时0.3,一定要设置,背景色才可以露出来*/
  26.   line-height:160rpx;/*字体行高与按钮相等,目的是让字体居中*/
  27.   padding: 0rpx;/*为了让字体居中*/
  28.   color:white;/*字体颜色*/
  29. }
  30. .green_style{
  31.   width:160rpx;
  32.   height:160rpx;
  33.   margin-left: 200rpx;
  34.   margin-top: -20rpx;
  35.   border-radius: 50%;
  36.   background-color: green;
  37.   opacity: 1;
  38.   line-height:160rpx;
  39.   padding: 0rpx;
  40.   color:white;
  41. }
  42. .blue_style{
  43.   width:160rpx;
  44.   height:160rpx;
  45.   margin-left: 400rpx;
  46.   margin-top: -150rpx;
  47.   border-radius: 50%;
  48.   background-color: blue;
  49.   opacity: 1;
  50.   line-height:160rpx;
  51.   padding: 0rpx;
  52.   color:white;
  53. }
  54. .beep_style{
  55.   width:160rpx;
  56.   height:160rpx;
  57.   margin-left: 530rpx;
  58.   margin-top: -330rpx;
  59.   border-radius: 50%;
  60.   background-color: black;
  61.   opacity: 1;
  62.   line-height:160rpx;
  63.   padding: 0rpx;
  64.   color:white;
  65. }
复制代码




不知道为什么  我的盒子模型的margin显示错误 ,但是其它的倒是正确。
我不知道是软件的BUG还是  其它地方没有设计好。
希望万能的鱼油 帮我看看!
感激不尽
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-2-23 00:31:42 | 显示全部楼层
container 没有定义样式?是不是得来个flex
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-4-28 06:56

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表