Comments (4)
关于这个问题,可能文档上没写清楚,由于 okam
框架是渐进式增强,因此如果需要使用 watch
能力,需要在构建配置 framework
增加配置项:['data', 'watch']
,所以请先确认下是否有加上相关配置。
from okam.
这个加上了,不报错,不过从父组件传过来的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都是空
from okam.
还有明确下是微信下还是?我这边在百度小程序、微信小程序都没有问题,支付宝小程序由于不支持 props observer 所以目前有点问题
from okam.
我用的微信,昨晚一直不可以,今天可以了
from okam.
Related Issues (20)
- was signed into my sons account
- App 脚本 app.js 配置时 文档里面 这样配置编译不通过,把globalData放到config 里面就不报错 HOT 4
- 误报,可以忽视,sorry
- 求支持v-前缀的兼容 HOT 1
- 配置项是正则表达式时merge函数会产生错误结果 HOT 1
- 模板中for循环可以正常使用,v-for不行
- 代码示例和线上项目收集 HOT 2
- template 中简写编译有误 HOT 1
- 如何使用 postcss 插件 HOT 2
- 内联样式当有逗号时编译错误 HOT 1
- 目前还在更新维护吗 HOT 3
- why would it called Okam? HOT 2
- vuex下通过mutation或action更新数据后,视图不更新 HOT 1
- 钉钉的小程序是怎么操作的? HOT 2
- ios下的input,@focus很慢,多个input 进行切换,状态不对
- okam框架中如何使用百度小程序的动态库? HOT 1
- okam css 后处理postcss支持其他postcss插件吗?比如雪碧图postcss-sprites,装了下插件依赖运行报错,若支持怎么配置? HOT 1
- 百度小程序无法找到 regeneratorRuntime 问题 HOT 2
- 百度小程序Page.onInit中不支持通过赋值this.xxx修改视图 HOT 1
- app.json未找到
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from okam.