2
当我尝试将道具传递给.vue
文件中的HTML元素属性时,它们只停止渲染。我究竟做错了什么?下面的代码:将道具传递给Vue组件中的元素属性
的script.js
import hInput from './components/hInput.vue'
Vue.component('h-input', hInput);
const app = new Vue({
el: '#head',
});
的index.php
<div id="head">
<h1>{{config('app.name')}}</h1>
<h-input placeholder="Hi" name="hello"></h-input>
</div>
hInput.vue
<template>
<div>
<input type="text" placeholder="{{placeholder}}">
</div>
</template>
<script>
export default {
props: ['placeholder', 'name']
};
</script>
干杯。你能告诉我如何在这个.vue文件中使用外部插件吗?特别是vee-validate,我使用了Vue.use(VeeValidate),它直接在组件文件之外工作,但不在里面。我以某种方式导入它? – Mav
@Mav我相信'script.js'中的'Vue.use(VeeValidate)'应该*使它在单个文件组件中可用。你在哪里打电话? – Bert
啊,它是可用的,我犯了一个错字,谢谢你:D – Mav