首页文档Github博客

Introduction

  • 介绍
  • 快速开始
  • 深入了解

The Basics

  • 模板语法
  • Class 与 Style 绑定
  • 条件渲染
  • 列表渲染
  • 事件处理
  • 生命周期函数

The Components

  • 基础组件

The Plugins

  • 简介
  • 插件基础

快速开始

安装

通过 npm 或者 yarn 安装

npm

npm install ditto-core --save

yarn

yarn add ditto-core

使用

Ditt 对项目没有严格的限制,可以按照自己的习惯创建项目目录。

示例

import Ditto from 'ditto-core';
import AppComponent from './app.js';

const App = Ditt.createCompiler('vue2');

const output = '/outputdir';
const entry = '/entrydir';
App.compile({
    app: App,
    entry: entry,
    output: output
})

如上所示,这里通过 Ditto.createCompiler('vue2') 创建了一个 vue2 类型的编译实例,通过这个实例可以将代码转换成对应的 vue 原生代码。

这里的转译是以组件或者路由配置文件为入口,并需要指定组件所在目录以及输出的目录,在编译的过程中会将组件所在的目录整体编译过去。

Copyright © 2017-2018 Yangxiaofu