Vue Script

Posted on  by admin

A simple code editor with syntax highlighting, built with Vue.js and Highlight.js. Install and import the simple-code-editor. Add the code editor to the app. Available editor props. v1.1.9 (04/15/2022). add new event langs which can get the language list in the first mounted.

v1.1.8 (04/14/2022). new feature: Getting the current language. v1.1.7 (04/10/2022). add clipboard api for copy code. v1.1.5 (04/07/2022). fixed repeat rendering and updated the js file in the browser.

v1.1.3 (03/25/2022). upadte dep: highlight.js. bug fixed: the synchronization of the width between textarea and highlight area, especially in dynamic layout.

bug fixed: suffix missing. Author: justcaliturner. Live Demo: https://simple-code-editor.vicuxd.com/. Download Link: https://github.com/justcaliturner/simple-code-editor/archive/refs/heads/master.zip.

Official Website: https://github.com/justcaliturner/simple-code-editor.

Declarative Rendering

You’re browsing the documentation for v2.x and earlier. For v3.x, click here.

Vue (pronounced /vjuː/, like view) is a progressive framework for building user interfaces.

  1. Unlike other monolithic frameworks, Vue is designed from the ground up to be incrementally adoptable.

  2. The core library is focused on the view layer only, and is easy to pick up and integrate with other libraries or existing projects.

  3. On the other hand, Vue is also perfectly capable of powering sophisticated Single-Page Applications when used in combination with modern tooling and supporting libraries.

If you’d like to learn more about Vue before diving in, we created a video walking through the core principles and a sample project. If you are an experienced frontend developer and want to know how Vue compares to other libraries/frameworks, check out the Comparison with Other Frameworks.

Conditionals and Loops

The official guide assumes intermediate level knowledge of HTML, CSS, and JavaScript.

If you are totally new to frontend development, it might not be the best idea to jump right into a framework as your first step - grasp the basics then come back!

  1. Prior experience with other frameworks helps, but is not required. The easiest way to try out Vue.js is using the Hello World example.
  2. Feel free to open it in another tab and follow along as we go through some basic examples.
  3. Or, you can create an index.html file and include Vue with:. The Installation page provides more options of installing Vue. Note: We do not recommend that beginners start with vue-cli, especially if you are not yet familiar with Node.js-based build tools.

If you prefer something more interactive, you can also check out this tutorial series on Scrimba, which gives you a mix of screencast and code playground that you can pause and play around with anytime.

Composing with Components

At the core of Vue.js is a system that enables us to declaratively render data to the DOM using straightforward template syntax:.

How to use it:

We have already created our very first Vue app! This looks pretty similar to rendering a string template, but Vue has done a lot of work under the hood. The data and the DOM are now linked, and everything is now reactive.

Description:

How do we know? Open your browser’s JavaScript console (right now, on this page) and set app.message to a different value. You should see the rendered example above update accordingly. Note that we no longer have to interact with the HTML directly.

A Vue app attaches itself to a single DOM element (#app in our case) then fully controls it.

The HTML is our entry point, but everything else happens within the newly created Vue instance. In addition to text interpolation, we can also bind element attributes like this:.

Install & Download:

Hover your mouse over me for a few seconds to see my dynamically bound title! Here we are encountering something new. The v-bind attribute you are seeing is called a directive.

Download Details:

Directives are prefixed with v- to indicate that they are special attributes provided by Vue, and as you may have guessed, they apply special reactive behavior to the rendered DOM.

Here, it is basically saying “keep this element’s title attribute up-to-date with the message property on the Vue instance.”. If you open up your JavaScript console again and enter app2.message = 'some new message', you’ll once again see that the bound HTML - in this case the title attribute - has been updated.

Handling User Input

It’s easy to toggle the presence of an element, too:. Go ahead and enter app3.seen = false in the console. You should see the message disappear. This example demonstrates that we can bind data to not only text and attributes, but also the structure of the DOM.