【发布时间】:2023-03-29 19:29:01
【问题描述】:
我正在使用 Vue.js 和 Meteor 开发一个简单的应用程序。我收到一个非常奇怪的错误: 'Cannot find element 'widget'' 即使在我看来它不应该给出这种错误。这些是我的文件: Main.html
<head>
<title>vue-blaze</title>
</head>
<body>
<h1>Welcome to Meteor!</h1>
{{> vue_demo}}
</body>
<template name="vue_demo">
<div id="app">
</div>
</template>
Main.js
import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import './main.html';
import {Vue} from 'meteor/akryum:vue';
import widget from '/imports/ui/Widget.vue';
//window.onload=function(){
var vm = new Vue({
el: '#widget',
render:h=>h(widget)
});
//}
Widget.vue
<template>
<div id="widget">
<div>Hello {{msg1}}!</div>
<input v-model="name" placeholder="Enter your name" />
</div>
</template>
<script>
import {Session} from 'meteor/session'
export default {
data() {
return {
msg1: 'Somebody'
}
}
}
</script>
<style scoped>
.widget {
background: #a0ddc4;
padding: 12px;
border-radius: 3px;
width: 300px;
border-bottom: solid 1px #40b883;
}
input {
display: block;
margin: 4px 0;
width: 100%;
box-sizing: border-box;
border: none;
padding: 6px 12px;
border-radius: 3px;
}
</style>
我不得不提一下,在更新到 Vue 2.0.3 之前一切正常。
【问题讨论】:
标签: javascript html meteor vue.js vuejs2