vue远程加载sfc组件思路详解(2)

<template> <div> <div> <p @click='$emit("handleClick",'点我')'>远程组件--{{msg}}--{{text}}</p> </div> </div> </template> <script> // 加载js脚本 let {a} = $require('utils/test.js') module.exports = { data: function() { return { msg: "remote component", ...a, } }, props: { text: { type: Boolean, default: true } }, mounted:function(){ console.log('prop text is',this.text) } }; </script> <style lang="stylus" scoped> .test { .test2 { color: red; } p{ color:red } } </style>

客户端渲染

// temolate <remote text='123456' @handleClick='handleClick'/> // script methods:{ handleClick(v){ console.log(v) // 点我 } }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/ec73bff411afba65799b0e0bc21c43ee.html