A simple example of how to use Vue3 + Flutter for hybrid layout to implement infinite scrolling waterfall stream.
前端新世界|Vue3 + Flutter element embedding
- Using
axios
for network requests. - Using
vant
for UI rendering.
To be able to use with the Flutter module, the following modifications have been made:
package.json
has a prebuild script for building Flutter Web application, which packages the Flutter Web products into public/flutter/.flutter.js
is added to index.html using thescript
tag.- The
components/FlutterView.vue
component is responsible for embedding Flutter Web, and allows external components to use it through Vue's emit and expose methods.
- The Element embedded Flutter project is located in the /flutter folder. This project is a standard web application and does not need to know that it will be embedded in another framework.
- Flutter uses the new
@staticInterop
method to allow certainDart
functions to be called fromJavaScript
. - Understand how to
createDartExport
mounts Flutter towindow
for Vue to call.
pnpm install
pnpm dev
pnpm prebuild