有没有用于在Vue.js中显示和实时编辑的库或包?

huangapple go评论77阅读模式
英文:

Is there any library or package to show and real time edit in vuejs?

问题

我想在Vue.js模板中像下面这样显示我的一部分代码。

有没有用于在Vue.js中显示和实时编辑的库或包?

那么,我如何添加一些代码片段,并让用户实时编辑它们,并在上面呈现输出。

英文:

I want to show my portion of code in vuejs template just like below.

有没有用于在Vue.js中显示和实时编辑的库或包?

So, How can I add show some piece of code & also let the user realtime edit there & render the output above.

答案1

得分: 1

"Run following snippet!" -- 在文本框中输入内容,标题将相应更改。

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->
new Vue({
  el: "#app",
  data: {
    title: "Hello!"
  }
});

<!-- language: lang-html -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.min.js"></script>

<div class="alert alert-success" id="app" role="alert">
  <h4 class="alert-heading">{{ title }}</h4>
  <p>Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.</p>
  <hr>
  <p class="mb-0">Whenever you need to, be sure to use margin utilities to keep things nice and tidy.</p>

  Change Title : <input type="text" v-model="title">
</div>

<!-- end snippet -->

注意:以上是您提供的代码段的翻译。

英文:

Run following snippet! -- Type something in textbox it will change the title accordingly.

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

new Vue({
  el:&quot;#app&quot;,
  data:{
    title:&quot;Hello!&quot;
  }
});

<!-- language: lang-html -->

&lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.min.js&quot;&gt;&lt;/script&gt;

&lt;div class=&quot;alert alert-success&quot; id=&quot;app&quot; role=&quot;alert&quot;&gt;
  &lt;h4 class=&quot;alert-heading&quot;&gt;{{ title }}&lt;/h4&gt;
  &lt;p&gt;Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.&lt;/p&gt;
  &lt;hr&gt;
  &lt;p class=&quot;mb-0&quot;&gt;Whenever you need to, be sure to use margin utilities to keep things nice and tidy.&lt;/p&gt;
  
  Change Title : &lt;input type=&quot;text&quot; v-model=&quot;title&quot;&gt;
  
&lt;/div&gt;

<!-- end snippet -->

huangapple
  • 本文由 发表于 2020年1月6日 15:13:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/59608037.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定