根据您提供的代码,wxml文件中的styles属性值是一个对象,包含了多个样式属性。这种写法在wxml文件中是不支持的。

如果您想为一个组件或元素设置样式,可以使用以下两种方式之一:

  1. 在wxml文件中使用内联样式:
<view style="position: fixed; width: 560rpx; height: 338rpx; top: 0; bottom: 0; left: 0; right: 0; margin: auto; background-color: #FFF; border-radius: 12rpx; z-index: 10;"></view>
  1. 在wxss文件中定义类样式:
<view class="my-style"></view>
.my-style {
  position: fixed;
  width: 560rpx;
  height: 338rpx;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto;
  background-color: #FFF;
  border-radius: 12rpx;
  z-index: 10;
}

请根据您的需求选择其中一种方式来设置样式

wxml文件中styles=positionfixedwidth560rpxheight338rpxtop0bottom0left0right0marginautobackgroundColor#FFFborderRadius12rpxzIndex10编译出错了

原文地址: http://www.cveoy.top/t/topic/i0v5 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录