[内容]
Environment Info:
System:
OS: macOS 10.14.2
CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Binaries:
Node: 10.12.0 - /var/folders/yc/5cmmwchj5z18t17bhwk4ls5c0000gn/T/yarn--1549163575327-0.4807895293962383/node
Yarn: 1.13.0 - /var/folders/yc/5cmmwchj5z18t17bhwk4ls5c0000gn/T/yarn--1549163575327-0.4807895293962383/yarn
npm: 6.5.0 - /usr/local/bin/npm
Browsers:
Chrome: 71.0.3578.98
Firefox: 64.0
Safari: 12.0.2
npmPackages:
@dcloudio/types: * => 0.0.2
@dcloudio/uni-app-plus-nvue: 0.0.1
@dcloudio/uni-cli-shared: * => 0.2.8
@dcloudio/uni-h5: * => 0.2.2
@dcloudio/uni-mp-alipay: * => 0.0.8
@dcloudio/uni-mp-baidu: * => 0.0.7
@dcloudio/uni-mp-weixin: * => 0.0.5
@dcloudio/vue-cli-plugin-hbuilderx: ^0.3.2 => 0.3.5
@dcloudio/vue-cli-plugin-uni: ^0.9.20 => 0.9.29
@dcloudio/webpack-uni-mp-loader: * => 0.3.2
@dcloudio/webpack-uni-pages-loader: * => 0.2.5
@vue/babel-helper-vue-jsx-merge-props: 1.0.0-beta.2
@vue/babel-plugin-transform-vue-jsx: 1.0.0-beta.2
@vue/babel-preset-app: 3.4.0
@vue/babel-preset-jsx: 1.0.0-beta.2
@vue/babel-sugar-functional-vue: 1.0.0-beta.2
@vue/babel-sugar-inject-h: 1.0.0-beta.2
@vue/babel-sugar-v-model: 1.0.0-beta.2
@vue/babel-sugar-v-on: 1.0.0-beta.2
@vue/cli-overlay: 3.4.0
@vue/cli-plugin-babel: 3.3.0 => 3.3.0
@vue/cli-plugin-typescript: ^3.3.0 => 3.4.0
@vue/cli-service: ^3.4.0 => 3.4.0
@vue/cli-shared-utils: 3.4.0
@vue/component-compiler-utils: 2.5.2
@vue/preload-webpack-plugin: 1.1.0
@vue/web-component-wrapper: 1.2.0
mpvue-page-factory: 1.0.1
mpvue-template-compiler: 1.0.13
vue: ^2.5.21 => 2.5.22 (2.5.22)
vue-class-component: ^6.3.2 => 6.3.2
vue-hot-reload-api: 2.3.1
vue-loader: 15.6.2
vue-property-decorator: ^7.2.0 => 7.3.0
vue-router: 3.0.1
vue-style-loader: 3.1.2 (3.1.2)
vue-template-compiler: ^2.5.21 => 2.5.22
vue-template-es2015-compiler: 1.8.2
vuex: ^3.0.1 => 3.1.0
weex-vue-loader: 0.7.0
npmGlobalPackages:
@vue/cli: 3.4.0
import { Component, Vue } from 'vue-property-decorator';
@Component()
export default class Index extends Vue {
onLoad() {
console.info('onLoad')
}
}
IDE运行环境说明
5 个回复
最佳回复
DCloud_UNI_GSQ
本来非 Vue 内置的钩子函数需要调用接口注册,例如:
Component.registerHooks('onLoad')
不过新版已经可以不用注册了,执行
npm update
更新即可。Bear大熊 (作者)
目前临时方案:
1***@qq.com
是created()吧
2019-06-22 10:18
h***@163.com
上一个简单的demo,create和onLoad都没有走进去,框架不是支持typeScript吗?怎么回事?
<template>
<view>
888
</view>
</template>
<script>
import { Component, Vue, Emit, Inject, Model, Prop, Provide, Watch } from 'vue-property-decorator'
@Component({
components: {}
})
export default class Home extends Vue {
create () {
console.log(777)
}
}
</script>
<style>
</style>
马赛克
我的created可以走,onLoad也不行
Bear大熊 (作者)
官方已解决: https://ask.dcloud.net.cn/question/66077