-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: this.$watch is not a function #3
Comments
关于这个问题,可能文档上没写清楚,由于 |
这个加上了,不报错,不过从父组件传过来的props更新后,watch没有任何变化 , framework: [
'data',
'ref',
'watch'
], index.vue <template>
<view>
<div @click='update'>Click check</div>
</view>
</template>
<script>
import Hello from '../../components/Hello';
export default {
config: {
title: 'Page Title'
},
components: {
Hello
},
data: {
title: 'title'
},
methods: {
update () {
this.title = 'title updated'
},
}
}
</script> <template>
<view class="hello-wrap">
{{title}}
</view>
</template>
<script>
export default {
config: {
},
props: {
title: String
},
created() {
this.$watch('title', function (newVal, oldVal) {
console.log('watch', newVal, oldVal, 'donw')
});
},
data: {
},
methods: {
}
};
</script> 点击页面上的update,子组件title看着是更新了,但watch这里newVal和oldVal都是空 |
还有明确下是微信下还是?我这边在百度小程序、微信小程序都没有问题,支付宝小程序由于不支持 props observer 所以目前有点问题 |
我用的微信,昨晚一直不可以,今天可以了 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
按文档这写的,https://ecomfe.github.io/okam/#/component/setData?id=%E7%9B%91%E5%90%AC%E5%99%A8
The text was updated successfully, but these errors were encountered: