Giter VIP home page Giter VIP logo

view's Introduction

View

原生 JavaScript 实现了仿 Vue 的简单指令如 v-model以及花括号插值.

代码摘要

HTML 如下:

<div id="app">
  <h1>{{title}}</h1>
  <input v-model="name">
  <h3>{{name}}</h3>
  <button v-on:click="clickMe">Say Hello</button>
</div>

JavaScript 写法和简单的 Vue 实例类似:

let view = new View({
  el: '#app',
  data: {
    title: 'View',
    name: 'Hedgehog'
  },
  methods: {
    clickMe() {
      alert('Hello!');
    }
  }
});

演示

演示非常简洁,用 h1h3 标签演示插值 , 一个输入框展示 v-model 指令,一个按钮展示 v-on 指令。

点这里 进入演示界面。

本地运行

把项目 clone 到本地后,在项目根目录运行下面这两个命令即可。

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm start

view's People

Contributors

dependabot[bot] avatar zhongyangxun avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.