详细问题描述
自定义组件 v-bind: app端只会取 scope上的数据,就算没取到也不会从data里面取值
[内容]
重现步骤
[步骤] 如图
[结果]
[期望]
[如果语言难以表述清晰,拍一个视频或截图,有图有真相]
IDE运行环境说明
[HBuilder 或 HBuilderX。如果你用其他工具开发uni-app,也需要在此说明]
[IDE版本号]
[windows版本号]
[mac版本号]
uni-app运行环境说明
[运行端是h5或app或某个小程序?]
APP
[运行端版本号]
cli最新版
[编译模式是老模板模式还是新的自定义组件模式?]
自定义组件模式
App运行环境说明
[Android版本号]
[iOS版本号]
[手机型号]
[模拟器型号]
附件
[IDE问题请提供HBuilderX运行日志。菜单帮助-查看运行日志,点右键打开文件所在目录,将log文件压缩成zip包上传]
[App问题请提供可重现问题的代码片段,你补充的细一点,问题就解决的快一点]
[App安装包或H5地址]
[可重现代码片段]
<template>
<default-page v-slot="{}">
<!-- <template v-slot='{msg}'> -->
<view class="content">
ssss
</view>
<grid-view :datas='datas' @onItemClick='onItemClick' :columnNum='4'>
<template v-slot="{item,index}">
<view class="item-container">
{{item}}
</view>
</template>
</grid-view>
<!-- </template> -->
</default-page>
</template>
<script lang="ts">
import {
Component,
Vue
} from "vue-property-decorator";
@Component
export default class NewPage extends Vue {
datas: any[] = new Array;
onItemClick({
item
}: any) {
console.log(item)
}
created() {
let temp = []
for (let i = 0; i < 50; i++) {
temp.push(i + 1)
}
this.datas = temp
}
}
</script>
<style lang="scss" scoped>
.item-container {
text-align: center;
color: #c9c9c9;
background: #f3f3f3;
height: 200rpx;
text-align: center;
line-height: 200rpx;
border-radius: 10rpx;
}
</style>
<template>
<view class="content">
<slot msg="公共页面数据"></slot>
<!-- <slot name="action" msg='action_msg'></slot> -->
</view>
</template>
<script lang="ts">
import {
Component,
Vue
} from "vue-property-decorator";
@Component
export default class DefaultPage extends Vue {
}
</script>
<style scoped lang="scss">
.content {
padding: 0 15rpx 0 15rpx !important;
box-sizing: border-box;
}
</style>
联系方式
[QQ]41677987