版权声明:尊重原创! https://blog.csdn.net/weixin_42675488/article/details/82958999
1、样式中需要注意组件与组件的样式不能重名写样式,不然会相互影响
/* 结构部分 */
<template>
<view></view>
</template>
<script>
import wepy from 'wepy';
// 引用外部组件,采用驼峰式命名
import Panel from '../components/panel';
// 声明一个Page页面实例,与声明组件的会不同
// export default class MyComponent extends wepy.component {}
export default class Index extends wepy.page {
config = {
navigationBarTitleText: '项目名称'
}
//可用于页面模板中绑定的数据
data = {
}
onLoad() {
}
// 事件
methods = {
}
// 声明页面中将要使用到的组件
components = {
}
}
</script>
<style lang="less">
</style>
项目循环组件遵循: repeat
// 这里for省略了小程序原生的 wx:
<repeat for="{{list}}" key="index" index="index" item="item">
</repeat >
<script>
//wepy改变this绑定数据
clickTab: function(e) {
this.currentTab= e.currentTarget.dataset.current
}
</script>