我最近开始使用 VueJS,我使用的是 v3,似乎在调用父级方法时遇到问题。子项中的发射函数似乎没有发出事件,父项中也没有接收到任何内容。
我已经包括了父母和孩子来展示我是如何设置的
家长
<template>
<First/>
< Child v-bind:sample="sample" @enlarge-text="onEnlargeText"/>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import axios from 'axios';
import First from './First.vue';
import Child from './Child.vue';
export default defineComponent({
name: 'Container',
components: {
First,
Child,
},
methods: {
onEnlargeText() {
console.log('enlargeText');
},
},
data: () => ({
sample: [],
parentmessage: '',
}),
created() {
axios.get('http://localhost:8080/getData')
.then((response) => {
console.log(response);
this.sample = response.data;
})
.catch((error) => {
console.log(error);
});
},
});
</script>
Run Code Online (Sandbox Code Playgroud)
孩子
<template>
<div …Run Code Online (Sandbox Code Playgroud) 有谁知道可以在vscode中设置文件关联吗?
我正在使用包含html的.pt文件,并且希望设置编辑器,这样当它打开这些文件时,它会自动将类型设置为html.