在 React 中运行 Vue react-vue

码农软件 · 软件分类 · Vue 组件 · 2019-03-20 10:26:37

软件介绍

React-Vue旨在连接 React 和 Vue,帮助您在 React 中运行 Vue。

用途:

  • 使用Vue 的 Reactivity 系统来观察React组件

  • 使用 react-vue-loader 以在React应用中运行Vue组件

Reactivity 系统

感谢 Vue 层次分明的简洁设计,我们可以很容易的将 reactivity 系统导出(9KB压缩包),并在其上驱动 React 组件

npm install --save react-vue
import React, { Component } from 'react';import Vue, { observer } from 'react-vue';const store = new Vue({  data () {    return {
      count: 0
    }
  },
  methods: {    increase () {      this.count ++;
    }
  }
});

@observerexport default class Demo extends Component {  render () {    return <h1 onClick={store.increase}>{store.count}</h1>;
  }
}

文档

Vue组件

引入react-vue-loader 可以将Vue组件编译成一个React组件。正如您所想的那样,您编写的Vue组件可以在React组件中运行,React组件也可以在Vue组件中运行。

npm install --save react-vue react-vue-helper
npm install --save-dev react-vue-loader
// One.jsimport React, { Component } from 'react';import Two from './Two';export default class One extends Component {  render() {    return <Two>Hello Vue</Two>;
  }
}
<!-- Two.vue --><template>
  <div @click="count++">
    <three>{{count}}</three>
    <slot></slot>
  </div>
</template>

<script>  import Three from './Three'  export default {    components: { Three },    data () {      return {        count: 0      }    }  }</script>
// Three.jsimport React, { Component } from 'react';export default class Three extends Component {  render () {    return <span>{this.props.children}</span>
  }
}

文档

本文地址:https://www.codercto.com/soft/d/1749.html

共鸣:内容运营方法论

共鸣:内容运营方法论

舒扬 / 机械工业出版社 / 2017-5-8 / 59.00

近5年来网络信息量增长了近10倍,信息极度过剩。移动互联网以碎片化、强黏度以及惊人的覆盖率给传统的商业环境带来了巨大的影响,向陈旧的广告、公关、媒体行业展开了深度的冲击。 传统的以渠道为中心的传播思想几近失效,优秀内容成为了各行业最稀缺的资产,这是时代赋予内容生产者的巨大机会。本书作者在多年经验和大量案例研究的基础上,总结出了移动互联网时代的内容运营方法论——共鸣,它将告诉我们如何收获核心粉......一起来看看 《共鸣:内容运营方法论》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

SHA 加密
SHA 加密

SHA 加密工具

html转js在线工具
html转js在线工具

html转js在线工具