12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- // components/blocks/home3/home3.js
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- items: {
- type: Array
- },
- specialData:{
- type: Object
- }
- },
- attached(){
- let has_margin = this.properties.specialData.has_margin;
- let sub_items_length = this.properties.specialData.items.length;
- let firstSubWidth = this.properties.specialData.items[0].width;
- if (has_margin){
- let scale = (1080 - (sub_items_length * firstSubWidth)) / (sub_items_length + 1);
- let padding = Math.ceil(((750 / 1080) * scale)) + 'rpx';
- this.setData({
- has_margin: has_margin,
- padding:padding
- });
- }
- },
- /**
- * 组件的初始数据
- */
- data: {
- has_margin:false,
- padding:''
- },
- /**
- * 组件的方法列表
- */
- methods: {
- }
- })
|