用oruga-next将VUE 2转换为VUE 3-可以使用o-switch的V模型,然后观看
我正在尝试将VUE 2的应用程序移植到VUE 3。我有问题。我不确定这些问题是模板中的“ V模型”,还是脚本区域中的“手表”命令。这是一个vue文件。
<template>
<div class="home notification is-primary">
<o-field>
<o-switch v-model="isSwitched" >
Audio: {{ isSwitched }}
</o-switch>
</div>
</template>
<script>
export default {
name: "HomeInput",
props: {
setAudio: Function,
},
data() {
return {
isSwitched:true,
};
},
methods: {
},
mounted: function () {
},
watch: {
'isSwitched' (val) {
console.log(val, "switch");
this.setAudio(val);
}
},
};
</script>
<style scoped>
</style>
尽管我可以在屏幕上看到组件开关,但我永远不会在控制台中获得“开关”。以下是我的软件包的一部分。我将Oruga-UI用于“ O-Switch”之类的Vue组件。
"dependencies": {
"@babel/cli": "^7.18.6",
"@babel/core": "^7.18.6",
"@babel/preset-env": "^7.18.6",
"@google-cloud/speech": "^4.10.0",
"@oruga-ui/oruga-next": "^0.5.5",
"@vue/babel-preset-app": "^5.0.7",
"@vue/cli": "^5.0.7",
"@vue/cli-plugin-babel": "^5.0.7",
"@vue/cli-plugin-eslint": "^5.0.7",
"@vue/cli-plugin-router": "^5.0.7",
"@vue/cli-service": "^5.0.7",
"@vue/compat": "^3.1.0-0",
"babel-loader": "^8.2.5",
"babel-preset-env": "^1.7.0",
"browser-request": "^0.3.3",
"browserify-fs": "^1.0.0",
"bulma": "^0.9.4",
"vue": "^3.2.37",
"vue-loader": "^17.0.0",
"vue-router": "^4.1.1",
"webpack": "^5.73.0",
"webpack-cli": "^4.10.0"
},
I am trying to port an application from vue 2 to vue 3. I have problems. I'm not sure if the problems are the 'v-model' in the template, or the 'watch' command in the script area. This is a vue file.
<template>
<div class="home notification is-primary">
<o-field>
<o-switch v-model="isSwitched" >
Audio: {{ isSwitched }}
</o-switch>
</div>
</template>
<script>
export default {
name: "HomeInput",
props: {
setAudio: Function,
},
data() {
return {
isSwitched:true,
};
},
methods: {
},
mounted: function () {
},
watch: {
'isSwitched' (val) {
console.log(val, "switch");
this.setAudio(val);
}
},
};
</script>
<style scoped>
</style>
I never get 'switch' in the console, though I can see the component switch on the screen. Below is part of my package.json. I use oruga-ui for the vue components like 'o-switch'.
"dependencies": {
"@babel/cli": "^7.18.6",
"@babel/core": "^7.18.6",
"@babel/preset-env": "^7.18.6",
"@google-cloud/speech": "^4.10.0",
"@oruga-ui/oruga-next": "^0.5.5",
"@vue/babel-preset-app": "^5.0.7",
"@vue/cli": "^5.0.7",
"@vue/cli-plugin-babel": "^5.0.7",
"@vue/cli-plugin-eslint": "^5.0.7",
"@vue/cli-plugin-router": "^5.0.7",
"@vue/cli-service": "^5.0.7",
"@vue/compat": "^3.1.0-0",
"babel-loader": "^8.2.5",
"babel-preset-env": "^1.7.0",
"browser-request": "^0.3.3",
"browserify-fs": "^1.0.0",
"bulma": "^0.9.4",
"vue": "^3.2.37",
"vue-loader": "^17.0.0",
"vue-router": "^4.1.1",
"webpack": "^5.73.0",
"webpack-cli": "^4.10.0"
},
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论