Skip to content

Flyforwards/Taro3-Vue3-Demo

 
 

Repository files navigation

Taro3-Vue3-Ts-Vuex-Demo

在 Taro3 中使用 Vue

https://taro-club.jd.com/topic/2267/%E4%BD%BF%E7%94%A8-vue3-%E5%BC%80%E5%8F%91%E5%B0%8F%E7%A8%8B%E5%BA%8F

使用 Taro + Vue 注意要点

  1. 使用小程序组件事件需要将 bind 换成@或者 v-on

    例如 小程序的点击事件 bindtap 换成@tap

  2. finally 无法使用

    yarn add promise-prototype-finally

  3. solt 的使用

    https://taro-docs.jd.com/taro/docs/hybrid#%E4%BD%BF%E7%94%A8-slot

  4. taro 3.0 + Vue 中 scoped 在 h5 下生效,在微信小程序中无效

Vue3 基本使用

  // option Api
  data() {
    return {
      res: [],
      msg: "",
    };
  },
  created() {
    this.getRes();
  },
  methods: {
    getRes: async function () {
      this.res = await test();
    },
  },
  setup() {
    const res = ref([]);
    const msg = ref("");
    const getRes = async () => {
      const result = await test();
      res.value = result;
    };
    getRes();
    return { res, msg };
  },

Vue3 文档

官方文档

About

Taro3 使用 Vue3 进行开发

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vue 37.4%
  • TypeScript 28.1%
  • JavaScript 21.7%
  • HTML 9.2%
  • SCSS 3.6%