VueJS 插件渲染问题。查看公式

VueJS plugin rendering problems. Vue Formulate

所以我不是 vueJs 的专业人士,这就是为什么如果您需要更多其他信息,只需写在评论中,我会尽力提供... 这就是我安装这个插件的方式

import VueFormulate from '@braid/vue-formulate';
Vue.use(VueFormulate);

在我想使用这个插件的模板中

<FormulateInput
  type="email"
  name="email"
  label="Enter your email address"
  help="We’ll send you an email when your ice cream is ready"
  validation="required|email"
/>

但是在浏览器页面上什么也没有,我在呈现的页面树中看到的是什么

<formulateinput 
  type="email" 
  name="email" 
  label="Enter your email address" 
  help="We’ll send you an email when your ice cream is ready" 
  validation="required|email">
</formulateinput>

所以我看到它没有渲染。

有点意思。当我想使用插件安装的组件然后在控制台插件对象中输出时,它退出

mounted() {  
   console.log(VueFormulate); 
}

来自控制台的屏幕

你能帮我找到我想念的东西吗? :3

试试这个工作代码:

App.js

<template>
  <div id="app">
  <FormulateInput
  type="email"
  name="email"
  label="Enter your email address"
  help="We’ll send you an email when your ice cream is ready"
  validation="required|email"
/></div>
</template>

<script>
import Vue from "vue";
import VueFormulate from '@braid/vue-formulate';
Vue.use(VueFormulate);

export default {
  name: "App",
};
</script>

<style>
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>

和Main.js必须是这样的:

import Vue from "vue";
import App from "./App.vue";

new Vue({
  render: h => h(App)
}).$mount("#app");

它实际上渲染了组件但没有样式!如果你想使用组件样式,写:

@import '../node_modules/@braid/vue-formulate/themes/snow/snow.scss';

在您的 scss 样式文件中或在您的项目中导入 https://github.com/wearebraid/vue-formulate/blob/master/dist/snow.min.css

主要问题出在模板标签中。

我模板中的 VueFormulate 组件 必须小写,连字符分隔并带有结束标记

<formulate-input
  type="email"
  name="email"
  label="Enter your email address"
  help="We’ll send you an email when your ice cream is ready"
  validation="required|email"
></formulate-input>

而不是

<FormulateInput
  type="email"
  name="email"
  label="Enter your email address"
  help="We’ll send you an email when your ice cream is ready"
  validation="required|email"
/>

更多关于语法风格的信息:

https://vuejs.org/v2/style-guide/#Component-name-casing-in-templates-strongly-recommended