JSFiddle - React, Tailwind, and code Playground

by Sokiraon

HTML

<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<div id="main">
  <el-button id="myButton" @click="changeText">按钮</el-button>
</div>

JavaScript

var Main = {
	data() {
  	return {}
  },
  methods: {
  	changeText() {
    	var text = document.getElementById("myButton").innerText;
      OpenCC.Converter('cn', 'tw')
				.then(convert => {
					console.log(convert('汉字'));
				})
    }
  }
};

var Ctor = Vue.extend(Main);
new Ctor().$mount('#main');